Question: Please help use java (BlueJ), comment the code and show the output thanks Write a program in Java according to the following specifications: The program
Please help use java (BlueJ), comment the code and show the output thanks
Write a program in Java according to the following specifications:
- The program reads a text file with student records (first name, last name and grade on each line).
- Then it prompts the user to enter a command, executes the command and loops. The commands are the following:
-
- "all" - prints all student records (first name, last name, grade).
- "excellent" - prints students with grade > 89.
- "ok" - prints students with grade <= 89.
- "end" - exits the loop the terminates the program.
For example, if the input text file is students.txt and the user enters "all" the program prints the following:
John Smith 90
Barack Obama 95
Al Clark 80
Sue Taylor 55
Ann Miller 75
George Bush 58
John Miller 65
If the user enters "excellent" the program prints the following:
John Smith 90
Barack Obama 95
If the user enters "ok" the program prints the following:
Al Clark 80
Sue Taylor 55
Ann Miller 75
George Bush 58
John Miller 65
Requirements and restrictions:
- Use the Students.java, Excellent.java, and Ok.java classes from the course website and make the following modifications/additions:
-
- Create an interface Student and implement it with classes Excellent and Ok to represent the excellent and ok students correspondingly.
- Create an ArrayList and fill it with objects of classes Excellent and Ok to store all students from the file.
- Use the ArrayList to print all, excellent and ok students. Use the instance of operator to distinguish between excellent and ok objects.
- When you write the program:
-
- use proper names for the variables suggesting their purpose.
- format your code accordingly using proper indentation and spacing.
- for each line of code add a short comment to explain its meaning.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
