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:
- Your program must start with comments giving your name and the name of the assignment.
- Your program must use good variable names.
- All methods and functions have a comment.
- All input must have a good prompt so that the user knows what to enter.
- All output must clearly describe what is output.
- The program must be your own work.
- All assignments for this class must be submitted in Blackboard.
- You must submit one word document that includes the source code, and screen shots of good test data.
- In addition please submit the Java file that you can find in the src folder of the project.
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
- Your program must start with comments giving your name and the name of the assignment.
- If there are any variables your program must use good variable names.
- All input (if any) must have a good prompt so that the user knows what to enter.
- All output must clearly describe what is output.
- The program must be your own work.
- All assignments for this class must be submitted in Blackboard.
- You must submit one word document that includes the source code, and screen shots of good test data.
- Assignments may be submitted up until midnight on the due date.
- You may use the assignment submission page to ask for help, but make sure that you clearly indicate that you are asking for help and not submitting for grading.
If you do not receive a perfect score you may resubmit it as long as it is resubmitted within 3 days.
Assignment IndexThis 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.