Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A large company pays its salespeople on a commission basis. The salespeople each

ID: 3541200 • Letter: A

Question

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 reeives $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 diplays 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

Explanation / Answer

#include<stdio.h>


int main (void)
{

int base = 200;
double salary;
int week;
float sales;
double commission;
week = 1;



printf ("Enter Sales, -1 to end: ", sales);
scanf ("%f", &sales);

//begin loop while sentinel value not yet read //
while (sales != -1)
{
commission = 0.09 * sales;
salary = commission + base;
++week;

printf ("Salary is ", salary);

}


return 0;

} /*end function main */


When I run the program in the win32 console, I get

"Enter Sales, -1 to end:"

1 (input)


(output)
Salary is
Salary is
Salary is

(nonstop repeat, with no calculations performed).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote