If statements & Rounding with Math.floor (75 points)
Write an applet which will accept an employees name, hours worked, and rate per hour.
Output a pay report which will include : Name, Hours Worked, Rate per hour, Overtime pay,
Regular pay, and Gross pay. Overtime will be calculated only with the amount of hours over
fourty. Overtime pay will equal the amount of time over fouty times the rate per hour times 1.5.
Make sure your project can produce the sample output below.
- If hours worked is 45.75 and rate per hour is $7.50, then
Overtime Pay = 5.75 * $7.50 * 1.5 = $64.69 (rounded)
Regular Pay = 40 * $7.5 = $300.0
Gross Pay = $300.0 + $64.69 = 364.69
- If hours worked is 32.25 and rate per hour is $6.05, then
Overtime Pay = $0.0
Regular Pay = 32.25 * $6.05 = $195.11 (rounded)
Gross Pay = $0.0 + $195.11 = $195.11
- Document your applet. Include your Name, Date, Project#, and a
description of the project.
- Input the data with the TextField class
- The hours worked and rate per hour must be of type float.
- Use an If statement to determine Overtime, Regular, and Gross pays.
- Activate the output with the Button class.
- Round all results to the hundreths place using the Math.floor method.
- Output your report with the TextArea class and setText method.
Sample Output for Project33