Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want the output to be 100% correct without any errors please In Lab Q1) Write a java program with the following steps: 1- Create

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

I want the output to be 100% correct without any errors please

In Lab Q1) 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 follo 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 empoyees 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 O 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 O to exit. Please enter your choice: 1 Please enter the name: Ahmad ali Please enter the SSN: 123 Please enter the gender: Male Please enter the major: Software engineering Please enter the id: 93210 Please enter the year of registration in the university: 2021 The allPersons array contains: Ahmad Ali 123 Male Software engineering 93210 2021 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 O to exit. Please enter your choice: 2 Please enter the name: Muna na'amneh Please enter the SSN: 500 The allPersons array contains: Ahmad Ali 123 Male Software engineering 93210 2021 Muna Na'amneh 456 Female Full-time 250 Waleed Samarah 789 Male Part-time 500 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 O to exit. Please enter your choice: 3 The employee/s with the maximum salary is/are: Waleed Samarah 789 Male Part-time 500 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. Please enter your choice: 4 The student/s with software engineering major is/are: Ahmad Ali 123 Male Software engineering 456 Please enter the gender: Female Please enter the type of employee: Full Time Please enter the salary: 250 The allPersons array contains: Ahmad Ali 123 Male Software engineering 93210 2021 Muna Na'amneh 456 Female Full-time 250 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 O to exit. Please enter your choice: 2 Please enter the name: Waleed Samarah Please enter the SSN: 789 Please enter the gender: Male Please enter the type of employee: Part Time Please enter the salary

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Making Databases Work The Pragmatic Wisdom Of Michael Stonebraker

Authors: Michael L. Brodie

1st Edition

1947487167, 978-1947487161

More Books

Students also viewed these Databases questions

Question

7. Identify four antecedents that influence intercultural contact.

Answered: 1 week ago

Question

5. Describe the relationship between history and identity.

Answered: 1 week ago