Question: Java: Exercise instructions: Design and implement the below class hierarchy representing individuals involved in a business. (First half of Diagram) (Second Half of Diagram) (Since

Java:

Exercise instructions: Design and implement the below class hierarchy representing individuals involved in a business.

(First half of Diagram)

Java: Exercise instructions: Design and implement the below class hierarchy representing individuals

(Second Half of Diagram)

involved in a business. (First half of Diagram) (Second Half of Diagram)

(Since the diagram is too large, I separated it in two pieces so it's clear enough)

Implement toString() method in each of the leaf classes: executive, full time salaried employee, full time hourly employee, part time hourly employee, hourly paid contractor, and customer. This method should return a String object that contains text information about all the attribute values, including the type of person, for that class instance. Feel free to use inheritance and implement toString() method in Person class and invoke or override it as needed in child classes. Also implement method introduce() that displays the information returned by toString() method to command line. Implement a variation of method introduce() to flag if social security number should be displayed or not. For objects of Customer type introduce() method should just never display SSN information.

Implement computePay() method in each of the leaf classes, except Customer class. For an executive, this method will not accept any input arguments. For a full time salaried employee, this method will accept the number of weeks as an input argument. For a part time hourly employee, a full time hourly employee, or an hourly paid contractor, this method will accept the number of hours as an input argument. For all of these individuals, this method will return a floating point value indicating the value of the pay for the specified input arguments. Remember that the logic of computing the pay is different for the different individuals. For an executive, the pay is simply their yearly compensation plus the yearly bonus. For a full time salaried employee, the pay is based on their yearly compensation adjusted to the number of weeks specified by the input argument. For a full time hourly employee, the pay is based on the hourly pay and the number of hours specified by the input argument. Make sure to account for possible overtime. For a part time hourly employee, the pay is based on the hourly pay and the number of hours specified by the input argument. Part time hourly employees are not allowed to work more than 40 hours a week, so implement a check for the proper number of hours and if they exceed 40 hours, return -1. For an hourly paid contractor, the pay is calculated by simply multiplying the number of hours they worked by the base pay.

Implement makePayment() method only available to customers. This method should display the preferred method of payment for the customer to command line screen.

Define and implement class BusinessTest.This class should implement main() method. In the body of the main() method you should create at least 2 instances of each of the leaf classes: executive, full time salaried employee, full time hourly employee, part time hourly employee, hourly paid contractor, and customer. It is up to you to choose which values of the attributes for each of the instances to use. For each instance, make a call to introduce() method and make a call to computePay() method for business associates and makePayment() for customers. Again, it is up to you to choose the input arguments into computePay() method where they are required. For visual presentation make sure to include an empty line between each employee instance output. Save this class and its definition into a file named BusinessTest.java.

Address > Person Business Test streetNum: int - streetName: String - city: String - Zip: String - state: String firstName: String lastName: String - age: int - ssn: String - address: Address Executiv. - yearlyBonus: Double yearlyCompensation: Doub + > Address(int, String, String, String, String) + getStreetNum(: int + getStreetName(): String + getCity: String getZipO: String + getState(): String + setStreetNum(int): void + setStreetName(String): void setCity(String): void + setZip(String): void + setState(String): void + toString(): String + > Person + > Person(firstName:String, lastName:String, address:Address, String ssn) + getFirstName(): String getLastName: String getAge(): int + getSSN(): String + getAddress: Address + setFirstName(String): void + setLastName(String): void + setAge(int): void + setSSN(String): void + setAddress(Address); void + toStringO: String + > Executive + cccreate>> Executive(firs lastName:String, address: A pay Double, bonus:Double, + getBonus(: Double + setBunus(Double):void + getCompensation0: Doub + setCompensation(Double + toString(): String + introduce(displaySSN:boc + computePayo: Double Customer - customerlD: int - payPreference: String > Employee A id: int - educationLevel: String directDeposit: boolean + > Customer + > Customer(firstName:String, lastName:String, address:Address, id:int, ssn: String) + getiDO: int + setID(int):void + getPayPreference(): String + setPayPreference(String):void + toString(): String + introduce(): void + makePayment(): void + > Employee() + > Employee(firstName:String, lastName:String, address:Address, id:int, ssn: String) + getiDO: int + getEducation(): String + getDirectDeposit(): boolean + setID(int): void + setEducation(String): void + setDirectDeposit(boolean): void + toString : String Contractor basePay: Double PartTimeHourly -baseHourlyPay: Double + > Contractor) + > Contractor(firstName:String, lastName:String, adress:Address, id:int, pay Double, ssn: String) + getBasePayO: Double + setBasePay(Double):void + toString(): String + introduce(displaySSN:boolean): void + computePay(numHrs:int): Double + > Part TimeHourly + > Part TimeHourly(firstName:String, lastName:String, adress:Address, id:int, pay:Double, ssn: String) + getHourlyPay0: Double + setHourlyPay(Double):void + toString(): String + introduce(displaySSN:boolean): void + computePay(numHrs:int): Double Full Time Salaried cutive Double + > Full Time Salaried + > Full Time Salaried (firstName:String, lastName:String, add:Address, id:int, salary:Double, ssn: String, ssn: String) + toString(): String + introduce(displaySSN:boolean): void + computePay(numWeeks:int): Double e e(firstName:String, ss:Address, id:int, cuble, ssn: String) oid Double ouble):void :boolean): void le > FullTimeEmployee - basePay: Double + > Full TimeEmployee +> FullTimeEmployee(firstName:String, lastName:String, address:Address, id:int, basePay:Double, ssn: String) + getBasePay(): Double + setBasePay(Double):void + toString: String FullTimeHourly overtimePay: Double + > FullTimeHourly +> FullTimeHourly(firstName:String, lastName:String, address:Address, id:int, basePay:Double, overtime:Double, ssn: String) + getOvertimePay(): Double + setOvertime(Double):void + toString: String + introduce(displaySSN:boolean): void + computePay(numHrs:int): Double Address > Person Business Test streetNum: int - streetName: String - city: String - Zip: String - state: String firstName: String lastName: String - age: int - ssn: String - address: Address Executiv. - yearlyBonus: Double yearlyCompensation: Doub + > Address(int, String, String, String, String) + getStreetNum(: int + getStreetName(): String + getCity: String getZipO: String + getState(): String + setStreetNum(int): void + setStreetName(String): void setCity(String): void + setZip(String): void + setState(String): void + toString(): String + > Person + > Person(firstName:String, lastName:String, address:Address, String ssn) + getFirstName(): String getLastName: String getAge(): int + getSSN(): String + getAddress: Address + setFirstName(String): void + setLastName(String): void + setAge(int): void + setSSN(String): void + setAddress(Address); void + toStringO: String + > Executive + cccreate>> Executive(firs lastName:String, address: A pay Double, bonus:Double, + getBonus(: Double + setBunus(Double):void + getCompensation0: Doub + setCompensation(Double + toString(): String + introduce(displaySSN:boc + computePayo: Double Customer - customerlD: int - payPreference: String > Employee A id: int - educationLevel: String directDeposit: boolean + > Customer + > Customer(firstName:String, lastName:String, address:Address, id:int, ssn: String) + getiDO: int + setID(int):void + getPayPreference(): String + setPayPreference(String):void + toString(): String + introduce(): void + makePayment(): void + > Employee() + > Employee(firstName:String, lastName:String, address:Address, id:int, ssn: String) + getiDO: int + getEducation(): String + getDirectDeposit(): boolean + setID(int): void + setEducation(String): void + setDirectDeposit(boolean): void + toString : String Contractor basePay: Double PartTimeHourly -baseHourlyPay: Double + > Contractor) + > Contractor(firstName:String, lastName:String, adress:Address, id:int, pay Double, ssn: String) + getBasePayO: Double + setBasePay(Double):void + toString(): String + introduce(displaySSN:boolean): void + computePay(numHrs:int): Double + > Part TimeHourly + > Part TimeHourly(firstName:String, lastName:String, adress:Address, id:int, pay:Double, ssn: String) + getHourlyPay0: Double + setHourlyPay(Double):void + toString(): String + introduce(displaySSN:boolean): void + computePay(numHrs:int): Double Full Time Salaried cutive Double + > Full Time Salaried + > Full Time Salaried (firstName:String, lastName:String, add:Address, id:int, salary:Double, ssn: String, ssn: String) + toString(): String + introduce(displaySSN:boolean): void + computePay(numWeeks:int): Double e e(firstName:String, ss:Address, id:int, cuble, ssn: String) oid Double ouble):void :boolean): void le > FullTimeEmployee - basePay: Double + > Full TimeEmployee +> FullTimeEmployee(firstName:String, lastName:String, address:Address, id:int, basePay:Double, ssn: String) + getBasePay(): Double + setBasePay(Double):void + toString: String FullTimeHourly overtimePay: Double + > FullTimeHourly +> FullTimeHourly(firstName:String, lastName:String, address:Address, id:int, basePay:Double, overtime:Double, ssn: String) + getOvertimePay(): Double + setOvertime(Double):void + toString: String + introduce(displaySSN:boolean): void + computePay(numHrs:int): Double

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!