Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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