Question
Inheritance Program. Driver, person, staff, student. ! java. I need some help with the driver class of this program. I have included the criteria for
Inheritance Program. Driver, person, staff, student. ! java.
I need some help with the driver class of this program. I have included the criteria for all the classes but the driver is the main one that I need help on. If someone could help that would be great.
How do you take the user input for student save it into an array list then be able to print all the information later.
the control panned will look like this the user will enter in the number of what they want to do. if they want to add staff it will ask them "enter id, enter first name, enter last name, enter title, enter hourly pay, enter hours per week" (all on their own lines ). For students it will ask them for "enter Id, enter first name, enter last name, enter gpa" (all on their own lines ).
1. Add Student
2. Add Staff
3. Print Students
4. Print Staff
5. Quit
example input for staff:
Enter id: 102
Enter first name: John Enter
last name: Doe
Enter title: Secretary
Enter hourly pay: 10
Enter hours per week: 40
it can then print this all out if the print option is picked.
Driver Class
- The addStudent method creates a new Student object using the the id, first name, last name, and gpa that it obtains from the Scanner, and adds this object to the students argument.
The addStaff method creates a new Staff object using the id, first name, last name, title, hourly pay, and hours per week that it obtains from the Scanner, and adds this object to the staff argument.
The printStudents and printStaff methods print all previously entered students and staff to the console as seen in the sample run. If no students or staff are present, a message indicating so should be printed.
The getMenuChoice method should display the menu, validate a choice it obtains from the Scanner, and return that choice.
The main method should create the student and staff lists (as well as the Scanner), call getMenuChoice, and validate/use its result to call the appropriate method in the class.
Here are the other classes.
Person class
- The constructor, accessors, and mutators behave as expected.
The equals method returns true only if the parameter is a Person and all instance variables are equal.
The toString method should generate a string describing the object with the following format: Person = Id: 100, name: John Doe
Student class
- This class inherits from the Person class.
The constructor and accessors behave as expected
The equals method returns true only if the parameter is a Student and all instance variables are equal (including those that are inherited).
The toString method should generate a string describing the object with the following format: Student = Id: 101, name: Jane Doe, gpa: 4.0
Staff class
This class inherits from the Person class
The constructor, accessors, and mutators behave as expected.
The equals method returns true only if the parameter is a Staff and all instance variables are equal (including those that are inherited).
The toString method should generate a string describing the object with the following format: Staff = Id: 102, name: John Doe, title: Secretary, hourly pay: 10.0, hours/week: 40.0
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