Zebra0.com

MCJava program: Employee Class

Java program: Employee Class

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.

Guidelines:

Grading Rubric

Rubric Points
Program works correctly, no errors 5
Comments, good names, indented 1
Clear user interface 1
Word document and Java File 1
Screen shots show good test data 2

Standards

If you do not receive a perfect score you may resubmit it as long as it is resubmitted within 3 days.
Assignment Index

This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.