Question
Use java Program: Your Employee class will have the employees name and hourly rate. There will be a method in the class called getPay that
Use java Program:
Your Employee class will have the employees name and hourly rate. There will be a method in the class called getPay that will receive the hours worked and return the pay. The name and hourly rate will be private. You will use get and set methods to assign values to the name and hourly rate. You will also have a displayEmployee method that prints out the employee name and hourly rate. The rate should show 2 decimal places: Example: Robin Banks earns $9.50 Calculate Pay method: If an employee works 40 hours or less the pay is simple the rate times the hours worked. If the employee works more than 40 hours he gets paid at the regular rate for the first 40 hours, and is paid at one and a half for each overtime hour. The main program should declare 3 different employees. One should work 30 hours, one 40, and one 42. Display the employee information and the weeks pay. A class should not interact with the user. If an invalid value is received it simple does not accept it. It does not display a message, it does not exit. It is up to the calling program to check if the value was accepted and display an appropriate message.
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