Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java please Q1) Write a java program with the following steps: 1- Create a java class file Person which has the following properties: >

in java please image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
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 san) 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 -yearof Regint -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) Student -major String -yearof Regint -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(Students):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 yearof Reg 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 -salarydouble + 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 emipoyees according to their ssn) Note: type data member takes Full Time, Part Time, Casual, or Outworkers 4- Create java main class fle Test and do the following: A) Declare an array al Persons 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 to exit. C) when the user chooses the first choice, you should check the allPersons array it is fut 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 al Persons 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 to ext. Please enter your choice 1 Please enter the name: Ahmad ali Please enter the SSN: 123 Please enter the gender Male of 10 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 al persons array contains Ahmad Al 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 to exit. Please enter your choice 2 Please enter the name: Muna na'amneh Please enter the SSN 5 of 10 456 Please enter the gender: Female Please enter the type of employee Full Time Please enter the salary 250 The al Persons 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 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 employees Part Time Please enter the salary 1003 to insert a now employee Choose 3 to retrieve the maximum salary Choose 4 to retrieve all software engineering students. Choose 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 500 The al Persons array contains: Ahmad Al 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 al software engineering students. Choose to exit. Please enter your choice 3 The employees with the maximum salary islare:Waleed Samarah 789 Male Pan-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 to exit Please enter your choice 4 The students with software engineering major is/are: Ahmad Al 123 Male Software engineering

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_2

Step: 3

blur-text-image_3

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

Is there just cause to dismiss Bonita? Explain your answer.

Answered: 1 week ago

Question

Explain the legal term assumption of risk .

Answered: 1 week ago