Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Create a Superclass University Employee: a. With three attributes to store: 1) baseSalary 2) department 3) yearsWorking b. toString() method which returns a
1. Create a Superclass University Employee: a. With three attributes to store: 1) baseSalary 2) department 3) yearsWorking b. toString() method which returns a String that indicates the baseSalary, department and the number of years the employee has been working in the university. c. Abstract method computeSalary(). d. Abstract method information(). 2. Extend a Professor class from the University Employee class: a. With one attribute: numOfCourses delivered by the professor. b. Override toString() method of the University Employee class, and return the number of courses delivered by that professor. c. Override computeSalary(): [base Salary+ (yearsWorking * 2000)] + numOfCourses * 1000 d. Override information(): method to print that "I am a professor in .... department and I have been working for... years. I teach ... courses. My base salary is $... and my final salary is $..." 3. Extend a Staff class from the University Employee class: a. With two attribute: bonus and typeOfContract (i.e. full time or part time). b. Override toString() method of the University Employee class, and return the bonus earned by the staff member and type of contract. c. Override computeSalary(): [base Salary + (years Working * 1500)] + bonus d. Override information(): method to print that "I am a staff member in ... department and I have been working for... years and I have worked on a ... contract. My base salary is $... and my final salary is $.... I have earned $.... as bonus." 4. Create a Driver class that: a. Create an array of four university employees, Create two professors and store it in the array, Create two staff members and store it in the array. b. Iterate over the array and print the intro message of the university employees by calling the information() methods. c. Iterate over the array and print the total salaries of all the professors and the total salaries of all the staff members. You may use input: Professor prof1=new Professor(120000,"Computer Science", 12, 4); Staff staff1=new Staff(90000, "Education", 7, 6000, "full time");
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