Question: (30 Pts) Write a class called Student. The class must have two fields: name of the String type and gpa of the double type.
(30 Pts) Write a class called Student. The class must have two fields: name of the String type and gpa of the double type. Write all the necessary constructors, getters, setters, and toString() methods. Now create another class called StudentBag. This class will allow you to store up to 1000 student objects in an array. The class should also have insert(Student student), removeByName(String name), findByName(String name), and display() methods. The display() method will only display the objects that are in the bag. Write a Demo class to demonstrate your StudentBag class by (1) inserting 5 students, (2) finding the second one, (3) removing the fourth one, and (4) displaying the remaining students in the bag.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
