Question: Create a base - class Worker and derived - classes HourlyWorker and SalariedWorker. Every worker has a name and a salary rate. Write a method

Create a base-class Worker and derived-classes HourlyWorker and SalariedWorker. Every worker has a name and a salary rate. Write a method computerPay(int hours) that computes the weekly pay for every worker. An hourly worker gets paid the hourly wage for the actual number of hours worked, if hours is at most 40. If the hourly worker worked more than 40 hours, the excess is paid at twice the salary rate. The salaried worker gets paid the hourly wage for 40 hours, no matter what the actual number of hours is. Write a main function to test these classes and method

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!