Question

In: Computer Science

Write a java program that prompt the user to insert last term’s courses and their individual...

Write a java program that prompt the user to insert last term’s courses and their individual mark and store them in an appropriate multidimensional array.

Solutions

Expert Solution

// importing all the packages required
import java.io.*;
import java.util.*;

class StoreData {
  // creating Array List which store another Array List into it
  static ArrayList<ArrayList<Object>> myArrayList = new ArrayList<>();

  // storing In the Array List
  public static void storeDataInArray(String course, int mark) {
    
    // creating an Array list to store data
    ArrayList<Object> temp = new ArrayList<>();
  
    // storing data in temp Array List
    temp.add(course);
    temp.add(mark);
    
    // storing the temp Array List into myArrayList
    myArrayList.add(temp);

    // printing the elements of Array List (myArrayList)
    System.out.println(myArrayList + " Added success in the Array List");
  }

  // Main function
  public static void main(String[] args) {
   Scanner sc = new Scanner(System.in);

   // taking Course input from user
   System.out.println("Enter the Course");
   String course = sc.nextLine();
   // taking mark input from user
   System.out.println("Enter the Individual mark");
   int mark = sc.nextInt();
  
   // calling the function to store data
   storeDataInArray(course, mark);
 }
}

Some output snippets

If the answer was helpful don't forget to upvote it, It keeps me motivated.

Thank you for your time have a good day:)


Related Solutions

Write by hand a full java program that will prompt the user for the length and...
Write by hand a full java program that will prompt the user for the length and width of a square, calculate and display the area of that square rounded to the nearest tenth with an appropriate message.
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user...
IN JAVA PROGRAMMING Write a complete Java program to do the following: a) Prompt the user to enter the name of the month he/she was born in (example: September). b) Prompt the user to enter his/her weight in pounds (example: 145.75). c) Prompt the user to enter his/her height in feet (example: 6.5). d) Display (print) a line of message on the screen that reads as follows: You were born in the month of September and weigh 145.75 lbs. and...
Using Java, write a program named MyAngles that will prompt the user for the measure of...
Using Java, write a program named MyAngles that will prompt the user for the measure of the three sides of a triangle and then reports the measurement of each interior angle of the triangle and the area of the triangle.
Answer in JAVA Write a program that would prompt the user to enter an integer. The...
Answer in JAVA Write a program that would prompt the user to enter an integer. The program then would displays a table of squares and cubes from 1 to the value entered by the user. The program should prompt the user to continue if they wish. Name your class NumberPowers.java, add header and sample output as block comments and uploaded it to this link. Use these formulas for calculating squares and cubes are: square = x * x cube =...
JAVA Write a java program that will sum all positive number. Prompt the user to enter...
JAVA Write a java program that will sum all positive number. Prompt the user to enter numbers and add all positive numbers. The program will not add negative numbers and the program will stop when you enter ‘0’.   Enter a number> 25 Enter a number> 9 Enter a number> 5 Enter a number> -3 Enter a number> 0 Sum = 39
I need a java code Write a simple program to prompt the user for a number...
I need a java code Write a simple program to prompt the user for a number between 1 and 12 (inclusive) and print out the corresponding month. For example:   The 12th month is December. Use a java "switch" statement to convert from the number (1-12) to the month. Also use a "do while" loop and conditional checking to validate that the number entered is between 1 and 12 inclusive and if not, prompt the user again until getting the correct...
Using Java! Write a program that ask prompt the user to enter a dollar amount as...
Using Java! Write a program that ask prompt the user to enter a dollar amount as double. Then, calculate how many quarters, dimes, nickels and pennies are in the dollar amount. For example: $2.56 = 10 quarters, 1 dime, 1 nickel and 1 cent. Print all of the values. Hint: Use Modulus operator and integer division when necessary.
Write a Java program called Decision that includes a while loop to prompt the user to...
Write a Java program called Decision that includes a while loop to prompt the user to enter 5 marks using the JOptionPane statement and a System. Out statement to output a message inside the loop highlighting a pass mark >= 50 and <= 100. Any other mark will output a messaging stating it’s a fail.
write java program that prompt the user to enter two numbers .the program display all numbers...
write java program that prompt the user to enter two numbers .the program display all numbers between that are divisible by 7 and 8 ( the program should swap the numbers in case the secone number id lower than first one please enter two integer number : 900 199 Swapping the numbers 224 280 336 392 448 504 560 616 672 728 784 840 896 i need it eclipse
write java program that prompt the user to enter two numbers .the program display all numbers...
write java program that prompt the user to enter two numbers .the program display all numbers between that are divisible by 7 and 8 ( the program should swap the numbers in case the secone number id lower than first one please enter two integer number : 900 199   Swapping the numbers 224 280 336 392 448 504 560 616 672 728 784 840 896 i need it eclipse
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT