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

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!