Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment is meant to be done in Java. Please make it easy to find/distinguish classes & interfaces. Given the Employee class and the Lawyer

This assignment is meant to be done in Java. Please make it easy to find/distinguish classes & interfaces.

image text in transcribed

image text in transcribed

image text in transcribed

Given the Employee class and the Lawyer class below: public class Employee { public int getHours () { return 40; // works 40 hours / week public double getSalary() { return 40000.0; 1/ $40,000.00 / year public int getVacationDays () { return 10; // 2 weeks' paid vacation public String getVacation Form() { return "yellow"; // use the yellow form public class Lawyer extends Employee { public int getVacationDays () { return super.getVacationDays () + 5; public String getVacation Form() { return "pink"; public void sue () { System.out.println("I'll see you in court!"); 1. Write an employee class Janitor to accompany the other employees. Janitors work twice as less hours (20 hours/week), they make $20,000 ($20,000 less than others), they get half as much vacation (only 5 days), and they have an additional method named clean that prints "Cleaning!." Use the super keyword to interact with the Employee superclass as appropriate. Write an employee class HarvardLawyer to accompany the other employees. Harvard lawyers are like normal lawyers, but they make 40% more money than a normal lawyer, they get 5 days more vacation, and they have to fill out four of the lawyer's forms to go on vacation. That is, the getVacation Form method should return "pinkpinkpinkpink". (If the normal Lawyer's vacation form ever changed, the HarvardLawyer's should as well. For example, if Lawyer's vacation form changed to "red", the HarvardLawyer's should return "redredredred".) Use the super keyword to interact with the Employee superclass as appropriate. 3. Write a client class called Employee Main that creates objects of Lawyer, Janitor and Hardvard Lawyer class in the main method. Write a method called printEmployee () that takes an object of Employee as a parameter and prints out salary, hour, vacation days and vacation form for the employee. Also call clean() method if you are printing a Janitor object. Call printEmployee() method from main method. Example output for Lawyer object Lawyer: Salary: $40000 Hours: 40 Vacation days: 15 Vacation form: pink

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions