Question: Write me the following Java program to manage information about students and teachers at a university. The program allows users to input information about teachers
Write me the following Java program to manage information about students and teachers at a university. The program allows users to input information about teachers and students, display this information, and search for students by their student ID
Please do not use break, continueexit return
Classes and Methods
Person Class Parent class
Has three private attributes: String first name, String last name, and int age.
Create A default constructor.
A parameterized constructor to initialize the first and last name.
Another parameterized constructor to initialize the first name, last name, and age.
Getters and Setters: for the variables
toString: Returns a string representation of the person.
Student Class first child class
The Student class also extends the Person class
Has private variables,
String studentID and Boolean variable passed: Whether the student has passed.
A default constructor.
A parameterized constructor to initialize the first name, last name, age, and student IDthe following first
name, last name, age from the ParentSuper class
Getters and Setters: for studentID and passed
Methods:
getPassStatus: return a String. will use the passed Boolean variable to check If the student passed return
Yes or didnt passed return No
an Override toString: Returns a string representation of the student firstNam, lastName, studentID, and
getPassStatus. firstNam, lastName from the super class
Teacher Classsecond child class
The Teacher class also extends the Person class.
Has private variable subject String:
A default constructor.
A parameterized constructor to initialize the first name, last name, and subject. first name, last name
from superclass
Another parameterized constructor to initialize the first name, last name, age, and subject. first name,
last name and age from superclass
Getters and Setters: for the subject variable
Methods:
Override toString: Returns a string representation of the teacher,First Name, last name and their
subject.First Name and last name from superclass
Main Class lastNameFirstNameHWjava
The LastNameFirstNameHWclass contains the main method
Variables and Lists:
check boolean: A flag to control the data entry loop.
passed boolean: A flag to indicate if a student has passed.
StudentFName, StudentLName, stuID String: Variables to hold student information.
students ArrayList: A list to store Student objects.
teachers ArrayList: A list to store Teacher objects.
Scanner: A Scanner object to read user input.
Start with while loop when the Boolean variable is true
Prompted the user to enter the teacher's first name, last name, and subject. Will enter the first Name first.
Check if the first name is equals done then will get out of the loop
Otherwise The user is prompted to enter the teacher's last name, and subject.
Create and Call the teacher constructor and add the constructor to the teacher array list.
Prompt the user to enter the student's first name, last name, age, and student ID
Create and Call the student constructor
The user is asked if the student has passed the class YesNo by entering Boolean variable, and pass the
variable to the set passed method.
add the constructor to the student array list
end the while loop
After data entry, the program displays information about all teachers and their students use a for loop
Display the teacher and the student sizes.
To search for studentID
Prompt the user to enter studentID
A while loop that allows the user to search for students by their student ID until "done" is typed.
The while loop will iterate as much as the studentID is not done
The program iterates through the students list to find a student with the matching IDuser for loop
Inside the for loop, use if statement to check if the studentID matches the studentID from the user input.
The student information is displayed;
Close if close the for loop
Otherwise, If a "not found" message is displayed.
Close if
Prompt the user to enter studentId again
Close the while loop
Close main
Close the class
Note: you might need to use trim with nextLine to get rid of the white spaces
input.nextLinetrim;
Submission Guidelines:
Submit your Java source code files PersonHWjava, TeacherHW.java, StudentHW.java and
lastNameFirstNameHW.java
Include the addendum in each class, total addendums
Include your first and last name inside main method.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
