Question: c++ Write a program that asks the number of hours worked and hourly pay rate, as floating point numbers. Then, it displays the calculated total

c++

c++ Write a program that asks the number of hours worked andhourly pay rate, as floating point numbers. Then, it displays the calculated

Write a program that asks the number of hours worked and hourly pay rate, as floating point numbers. Then, it displays the calculated total pay. Hours worked over 40 hours are considered as overtime and should be calculated at 1.5x the pay rate. Be sure to have input validation. If one or both input values are negative values, it does not make sense. If a pay rate of -$10 and 41 hours worked, then the pay would be -$415. Instead of printing the negative value of the pay, print Invalid input". For example, if Punith worked 42 hours (40 hours + 2 hours of overtime), and his pay rate is $12. Then, his paycheck will be $516. Regular Pay: Overtime Pay: Total Pay: $ 480.00 $ 36.00 $ 516.00 ($12 x 40 hours) (1.5 x $12 * 2 hours) The total pay(pay check) should be formatted with a two-digit precision as shown below. Input Expected 45.5 17.6 Enter the number of hours worked- Enter an hourly pay rate- Paycheck: 849.20 40 -10 Enter the number of hours worked- Enter an hourly pay ratew Invalid input 30 15 Enter the number of hours worked- Enter an hourly pay ratew Paycheck: 450.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!