Question
Java Create a class named Student that contains fields to hold methods for setting and getting a Student Id, Name, and marks. Save the file
Java
Create a class named Student that contains fields to hold methods for setting and getting a Student Id, Name, and marks. Save the file as Student.java. Write an application that asks for the number of students to be recorded and instantiates Student objects. It should prompt the user for values for the Student Id, Name and Marks. Then prompt the user to enter the field the Student records should be sorted byStudent Id, Name, or Marks. Perform the requested sort procedure and display the Student records in descending order. Save the file as StudentSort.java. The application should continue to ask for more sorting until user enter 1 to continue. To exit enter any integer other than 1.
outPut Number of student records to be entered 5 Enter student data Enter data for Student 1 Enter student Id 401 Enter student marks 44.5 Enter student name John Enter data for Student 2 Enter student Id 204 Enter student marks 33.5 Enter student name Mary Enter data for Student 3 Enter student Id 305 Enter student marks 88.6 Enter student name Kim Enter data for Student 4 Enter student Id 102 Enter student marks 45.6 Enter student name Fred Enter data for Student 5 Enter student Id 503 Enter student marks 66.8 Enter student name Tom Information about the student records eneterd:
Student Id: 401 Student Name: John Student marks: 44.5 Student Id: 204 Student Name: Mary Student marks: 33.5 Student Id: 305 Student Name: Kim Student marks: 88.6 Student Id: 102 Student Name: Fred Student marks: 45.6 Student Id: 503 Student Name: Tom Student marks: 66.8 Enter 1 to sort records by Student Id, 2 to sort by Name, 3 to sort by marks 1 Information about the student records sorted by Student ID Student Id: 503 Student Name: Tom Student marks: 66.8 Student Id: 401 Student Name: John Student marks: 44.5 Student Id: 305 Student Name: Kim Student marks: 88.6 Student Id: 204 Student Name: Mary Student marks: 33.5 Student Id: 102 Student Name: Fred Student marks: 45.6 Do you want to display sorted student records again? Press 1 to continue 1 Enter 1 to sort records by Student Id, 2 to sort by Name, 3 to sort by marks 2 Information about the student records sorted by Student Name Student Id: 503 Student Name: Tom Student marks: 66.8 Student Id: 204 Student Name: Mary Student marks: 33.5 Student Id: 305 Student Name: Kim Student marks: 88.6 Student Id: 401 Student Name: John Student marks: 44.5 Student Id: 102 Student Name: Fred Student marks: 45.6 Do you want to display sorted student records again? Press 1 to continue 1 Enter 1 to sort records by Student Id, 2 to sort by Name, 3 to sort by marks 3 Information about the student records sorted by Student Marks Student Id: 305 Student Name: Kim Student marks: 88.6 Student Id: 503 Student Name: Tom Student marks: 66.8 Student Id: 102 Student Name: Fred Student marks: 45.6 Student Id: 401 Student Name: John Student marks: 44.5 Student Id: 204 Student Name: Mary Student marks: 33.5 Do you want to display sorted student records again? Press 1 to continue
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started