Question
C++ Programming 1 Write a C++ program that prompts the user to enter three numbers. The first number should represent the pay grade of a
C++ Programming
1 Write a C++ program that prompts the user to enter three numbers. The first number should represent the "pay grade" of a person (valid values are 1, 2, 3). The second number represents the number of hours worked in a given week by a person. The third number represents the hourly rate at which that person is paid. The program should utilize nested selection structures to calculate and output the amount of money earned by that person where a person with paygrade "2" earns twice as much as a person with paygrade "1" for the same hours worked, and a person with paygrade "3" earns three times as much as a person with paygrade "1" for the same hours worked.
2. Modify the program from problem 1 so that if any of the following occur, your program peforms no calculations and reports any of the following errors:
Anything other than 1,2, or 3 are entered for paygrade
A negative number (or zero) is entered for hours worked
A negative number (or zero) is entered for rate
A person with a paygrade of 2 worked less than 20 hours
A person with a paygrade of 3 worked less that 40 hours
3. Modify the program from problem 2 so that each input statement is inside a loop that validates the input. In other words, the program should still notify the user of the specific error but then continually prompt the user to re-enter the input. In addition, you must include at least one while loop and one do-while loop.
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