A large company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who sells $5000 worth of chemicals in a week receives $200 plus 9% of $5000, or a total of $650. Develop a C++ program that uses a while statement to input each salesperson’s gross sales for last week and calculates and

displays that salesperson’s earnings. Process one salesperson’s figures at a time.

Enter sales in dollars (-1 to end): 5000.00
Salary is: $650.00
Enter sales in dollars (-1 to end): 6000.00
Salary is: $740.00
Enter sales in dollars (-1 to end): 7000.00
Salary is: $830.00
Enter sales in dollars (-1 to end): -1


Top:
For an arbitrary number of salespeople, determine each salesperson’s earnings for the previous week
First refinement:
For each salesperson
Input the salesperson’s sales for the week
Calculate and print the salesperson’s wages for the week
Second refinement:
Prompt the user for the first salesperson’s sales in dollars
Input the first salesperson’s sales in dollars
While the sentinel value (-1) has not been entered for the sales
Calculate the salesperson’s wages for the week as 200 dollars added to 9 percent of the salesperson’s sales (calculated by multiplying the sales with .09)
Print the salesperson’s wages for the week
Prompt the user for the next salesperson’s sales in dollars
Input the next salesperson’s sales in dollars

```
// Calculate salesperson earnings.
#include
#include // parameterized stream manipulators
using namespace std;

int main()
{
double sales; // gross weekly sales
double wage; // commissioned earnings

// processing phase
// get first sales
cout << "Enter sales in dollars (-1 to end): ";
cin >> sales;

// set floating-point number format
cout << fixed << setprecision( 2 );

// loop until sentinel value read from user
while ( sales != -1.0 )
{
wage = 200.0 + 0.09 * sales; // calculate wage
cout << "Salary is: $" << wage; // display salary

// prompt for next sales
cout << "\n\nEnter sales in dollars (-1 to end): ";
cin >> sales;
} // end while
} // end main
```
Enter sales in dollars (-1 to end): 5000.00
Salary is: $650.00
Enter sales in dollars (-1 to end): 6000.00
Salary is: $740.00
Enter sales in dollars (-1 to end): 7000.00
Salary is: $830.00
Enter sales in dollars (-1 to end): -1

Computer Science & Information Technology

You might also like to view...

Most companies resolved the problems of stand-alone computing by joining clients into a _____ that allows sharing of data and hardware resources.?

A. ?storage area network (SAN) B. ?wide area network (WAN) C. ?desk area network (DAN) D. ?local area network (LAN)

Computer Science & Information Technology

According to the information presented in this video, all of the following activities are likely to occur in the information requirements determination (IRD) phase of systems analysis except _____.

A. reviews of? paper-based forms and reports B. meetings with the development team C. beta testing D. observation of system use E. interviews with system users

Computer Science & Information Technology

The essence of software engineering practice might be described as: understand the problem, plan a solution, carry out the plan, and examine the result for accuracy. 

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

____ is a facility for transferring files securely.

A. L2TP B. PPTP C. PPP D. Secure Copy (SCP)

Computer Science & Information Technology