Description
In this project, you are to create a simple object, put that object in a simple collection class, use that object and collection in a simple GUI application.
This problem calculates an average for students in a class. This application will create a Student class which will store the student’s name and score on a test. All scores will be between 0 and 100. This Student class should take the student’s name and score in the constructor, and should have a get method to retrieve the score (not the student’s name). There should have no methods in the class to modify either the student’s name or score. You should also have a toString method in this class, which will convert the object to a string containing the student’s name and score. This method will be used later in the GUI portion of this project.
The application will now have a simple GUI which will have two fields to input the student’s name and score, and 3 output fields to implement the current average, the current highest grade, and the current lowest grade. There are also 3 buttons. The first button is an enter button. When the enter button is pressed, the program should read the student’s name and score, create a Student object to store this information, and store this student record in an ArrayList of student records. The enter button will also use the score for this student to calculate the new average for the class, as well as the highest and lowest grades in the class for the scores entered so far. The second button will be a list button, and will be explained below. The third button is an exit button, which will exit the application.
The list button for this application works as follows. You will create a JList in a JScrollPane. To this JList you will enter all of the Student objects which are stored in the ArrayList of Student objects. Note that you will add the Student objects, you are not to retrieve the String name and the score, make them into a String, and add that String to the JList. Instead, if you properly implemented the toString method the JList will convert the Student object to a String which will display this data.