Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Design an interface called payable in Java with the following methods: double calculatepay ( ) - This method should calculate and return the amount of

Design an interface called payable in Java with the following methods:
double calculatepay()- This method should calculate and return the amount of pay for an employee.
Now, create two classes HourlyEmployee and salariedemployee that implement the Payable interface.
Implement the calculatepay() method in each class to represent the pay calculation for an hourly employee
and a salaried employee respectively.
For the HourlyEmployee class:
It should have instance variables for hourly wage and hours worked.
Implement the calculatepay() method to calculate the pay as the product of hourly wage and hours
worked.
For the
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 (e.g.,12 for monthly pay).
In main. Instantiate objects of
and salariedEmployee classes, set their attributes, and print the
amount of pay for each employee using the calculatepay() method.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

What are the two sources of experimental error?

Answered: 1 week ago

Question

3. Design a program for preparing for cross-cultural assignments.

Answered: 1 week ago

Question

2. Develop a program for effectively managing diversity.

Answered: 1 week ago

Question

7. What is coaching? Is there only one type of coaching? Explain.

Answered: 1 week ago