Question: In java Student Program using an ArrayList of objects In this program, we will use the given Student class (Student.java) to create an ArrayList of

In java

Student Program using an ArrayList of objects

In this program, we will use the given Student class (Student.java) to create an ArrayList of Student objects. Make a new class called StudentMenu (StudentMenu.java) that contains a main method for this program). Create the following menu of options that will be used to manage the ArrayList.

Student Menu:

1 - Add new student

2 - Display all students

3 - Search for student (by id)

4 - Search for student (by last name)

5 - Modify a students gpa

6 - Remove student (by id)

7 - Exit Please enter your choice:

Menu options should work as described here:

1 - Add new student

Prompt the user to enter a student's information (first name, last name, id, and gpa).

Each student should have a unique id. When a user enters an id, check that the id does not already exist in

the list. If the id already exists, display the message Error: id already exists.

2 - Display all students

Display all of the students in the list.

3 - Search for student (by id)

Input the id from the user, search for the student, and display the students information.

4 - Search for student (by last name)

Input the last name from the user, search for the student, and display the students information. If there are multiple students with the same last name, all should display.

5 - Modify a students gpa

Ask the user to enter the id of the student to be modified. Find the student, prompt the user to enter the students new gpa, and use the setGpa() method to update the gpa.

6 - Remove student (by id)

Ask the user to enter the id of the student to remove. Find and remove that student from the list.

7 - Exit

Stop the menu loop.

*Run your program and test all of the menu options. Include the output in a separate text or Word document.

student java:

public class Student {

private String firstName;

private String lastName;

private int id;

private double gpa;

public Student(String firstName, String lastName, int id, double gpa){

this.firstName = firstName;

this.lastName = lastName;

this.id = id;

this.gpa = gpa;

}

/**

* @return the firstName

*/

public String getFirstName() {

return firstName;

}

/**

* @param firstName the firstName to set

*/

public void setFirstName(String firstName) {

this.firstName = firstName;

}

/**

* @return the lastName

*/

public String getLastName() {

return lastName;

}

/**

* @param lastName the lastName to set

*/

public void setLastName(String lastName) {

this.lastName = lastName;

}

/**

* @return the id

*/

public int getId() {

return id;

}

/**

@param id the id to set

*/

public void setId(int id) {

this.id = id;

}

/**

* @return the gpa

*/

public double getGpa() {

return gpa;

}

/**

* @param gpa the gpa to set

*/

public void setGpa(double gpa) {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!