Question: Design an interface calledPayable in Java with the following methods: 1 . double calculatePayOan employee. - This method should calculate and return the amount of
Design an interface calledPayable in Java with the following methods: double calculatePayOan employee. This method should calculate and return the amount of pay forNow, create two classesHour LyEmployee andSalariedEmployee that implementthePayable interface. Implement the calculatePay method in each class to represent the pay calculation for art hourly employee and a salaried employee respectively.For the HourlyEmployeeclass: It should have instance variables for hourly wage and hours worked. Implement the calculatePaymethod to calculate the pay as the product of hourlywage and hours worked.For the SalariedEmployee class: It should have an instance variable for the annual salary. Implement the calculatePay method to calculate the pay as the annual salary divided by the number of pay periods in a year eg for monthly payIn main. Instantiate objects of HourlyEmployee andSalariedEmployeeattributes, and print the amount of pay for each employee using the calculatePayO method
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
