Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago