Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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++
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.00Step 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