Question
Write a java program with the following steps: 1- Create a java class file Person which has the following properties: > Person -name:String -gender:String -SSN:long
Write a java program with the following steps: 1- Create a java class file Person which has the following properties: > Person -name:String -gender:String -SSN:long +constructors (you should include all the needed constructors) +getters and setters(you should include the setters and getters needed for data members) +override method toString():String (represent the person with all his/her information) +override method equals(Person p):boolean (it will check the equality of any two persons according to their name and ssn) Note: gender data member takes Male or Female value. 2- Create another java class file Student inherited from Person class which has the following properties: Student -major:String -yearofReg:int -ID:long +constructors (you should include all the needed constructors) +getters and setters(you should include the setters and getters needed for data members) +override method toString():String (represent the Student with all his/her information) +override method equals(Student s):boolean (it will check the equality of any two students according to their id) Note: major data member takes Computer Science, Computer Engineering, Software Engineering, Computer Information System, or Network Engineering and Security value only, and yearofReg represents the year of registration in the major. 3- Create a final java class file Employee inherited from Person class which has the following properties: Employee -type:String -salary:double +constructors (you should include all the needed constructors) +getters and setters(you should include the setters and getters needed for data members) +override method toString():String (represent the employee with all his/her information) +override method equals(Employee e):boolean (it will check the equality of any two emlpoyees according to their ssn) Note: type data member takes Full Time, Part Time, Casual, or Outworkers. 4- Create java main class file Test and do the following: A) Declare an array allPersons of type person with size 5. B) Print the following menu to give the user optionality: Choose 1 to insert a new student. Choose 2 to insert a new employee. Choose 3 to retrieve the maximum salary. Choose 4 to retrieve all software engineering students. Choose 0 to exit. C) when the user chooses the first choice, you should check the allPersons array if it is full then give him/her a sorry, you reach the maximum length message else prompt from the user to enter full information for the new student (name, SSN, gender, major, yearofreg, and id) then print all the persons with the new one. D) when the user chooses the second one, you should check the allPersons array if it is full then give him/her a sorry, you reach the maximum length message else prompt from the user to enter full information for the new employee (name, SSN, gender, type, and salary) then print all the persons with the new one. E) when the user chooses the third choice, you should retrieve the information of all employees with a maximum salary. F) when the user chooses the last choice, you should retrieve the information of all the students with a software engineering major. Sample Run: Choose 1 to insert a new student. Choose 2 to insert a new employee. Choose 3 to retrieve the maximum salary. Choose 4 to retrieve all software engineering students. Choose 0 to exit.
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