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

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.
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...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that (a) asks the student to input his/her name, student ID, marks for these 5 courses, (b) calculate the average, (c) determine the letter grade of each course. (d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-. (e) Output the following information in a nice format: student name, student ID, listing of marks, the average,...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that...
Java Program Suppose a student was taking 5 different courses last semester. Write a program that (a) asks the student to input his/her name, student ID, marks for these 5 courses, (b) calculate the average, (c) determine the letter grade of each course. (d) record the number of courses whose final letter grade is A+, A, A-, .... , F+, F, F-. (e) Output the following information in a nice format: student name, student ID, listing of marks, the average,...
Create in Java a program that will prompt the user to enter aweight for a...
Create in Java a program that will prompt the user to enter a weight for a patient in kilograms and that calculates both bolus and infusion rates based on weight of patient in an interactive GUI application, label it AMI Calculator. The patients weight will be the only entry from the user. Use 3999 as a standard for calculating BOLUS: To calculate the BOLUS you will multiply 60 times the weight of the patient for a total number. IF the...
Create in java a program that will prompt the user to enter a weight for a...
Create in java a program that will prompt the user to enter a weight for a patient in kilograms and that calculates infusion rates based on weight of patient in an interactive GUI application, label it HEPCALC. The patients’ weight will be the only entry from the user. To calculate the infusion rate you will multiply 12 times the weight divided by 50 for a total number. The end result will need to round up or down the whole number....
Please write the code JAVA Write a program that allows the user to enter the last...
Please write the code JAVA Write a program that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate      Votes Received                                % of Total Votes...
jgrasp environment, java write a complete program that calculates a restaurant bill. Prompt the user for...
jgrasp environment, java write a complete program that calculates a restaurant bill. Prompt the user for the check amount, then ask the user what type of tipp they would like to leave: the choices are 1 for good tip (20%), 2 for an average tip (15%), or 3 for poor tip (10%). Use their input and an if-else to calculate the tip amount. Then calculate and output the final bill: check+tip print out the bill, exactly as shown (print the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT