Question
Write a program WITH C++ that calculates and prints the amount of wages due to an employee for a week's work. The program starts by
Write a program WITH C++ that calculates and prints the amount of wages due to an employee for a week's work. The program starts by asking the number of hours worked in the week and the hourly rate. Any hours worked beyond the regular 40 hours and up to 60 hours earns 1.5 times the regular hourly rate. Any hours worked beyond 60 and up to 80 earns 2 times the regular hourly rate.
After reading the hours and hourly rate, the program must also ask if any hours worked in the week was on a holiday. If so, those hours must be deducted from the regular hours and applied a rate of 2 times the regular rate. For example, if hours worked was 40, but 8 of them was on a holiday, 32 hours earns the regular rate and 8 hours at double the regular rate. If 55 hours was worked, but 5 of the hours was on a holiday, 35 hours is regular (40 - 5), 5 hours at twice the rate (for holiday hours), and remaining 15 hours at 1.5 times the regular rate. If 70 hours was put in, 10 of them on a holiday, 30 is at regular rate (40 - 10), 10 at double the rate (for holiday hours), 20 at 1.5 times and the remaining 10 again at double the rate because it was more than 60 (30+10+20+10 = 70).
Finally, ask the user if the employee had a birthday in the week. If so, add a bonus of 7% of the wages due and display the total, including the bonus, in currency format,
Submit only the cpp file.
Example:
Enter hours worked for the week: 45
Enter hourly rate: $10
How many of these were on a holiday? 5
Did the employee have a birthday in the week [y/n]? y
Wages due for the week: $561.75
Press any key to continue.
In the above example, since 5 hours was on a holiday, it leaves 35 for regular hours at $10 an hour ($350), plus 5 holiday hours at double the regular rate ($100), plus the 5 hours that were beyond the regular 40 hours which earn 1.5 times the regular rate ($75), for a total of $525. Finally, since the employee had a birthday in the week, 7% of $525 was added to the total.
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