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

C++ The sales manager at Tompkins Company wants a program that calculates and di

ID: 644578 • Letter: C

Question

C++

The sales manager at Tompkins Company wants a program that calculates and displays each salesperson's commission, which is 10% of his or her sales. It also should display the total commission. Use a value-returning function to get the amount sold by a salesperson. The amount sold may contain a decimal place. Also use three void functions: one to calculate the 10% commission, another to display the commission, and another to calculate the total commission. The program should display the commission and total commission in fixed-point notation with two decimal places. Display the total commission only after the sales manager has finished entering the sales amounts. Use a sentinel value to end the program.

Test the program using the following four sales amounts: 12000, 23000, 10000, and 25000. Then enter your sentinel value.

Explanation / Answer

#include<iostream>

#include<assert.h>

#include<fstream.h>

#include<iomanip>

using namespace std;

void calcCommission(double &sales)

void calcTotCommission(double saleFig,double &totcom);

void displayCommission(double commission,double totCommission);

int main()

{

const double UNIT_CHG = .1;

double sales = 0.0;

double commission;

double total = 0.0;

cout << fixed << setprecision(2);

calcCommision(sales);

total = calcTotCommission(sales,UNIT_CHG, total);

displayCommission(commission,total);

system("pause");

return 0;

}

void calCommission(double &sales)

{

cout << "sales: ";

cin >> sales;

}

void calcTotCommission(doublesaleFig,double &totCom)

{

totCom = saleFig * .10;

}

void displayCommission(double commission,double totCommission)

{

cout << "Commission : $" << commission << end1;

cout << "Total Commission: $" << totCommission << end1;

{

int value;

ofstream fout;

const int SENTINEL = 12000;

fout.open("value.dat", ios : out);

file

   assert(! fout.fail());

cout << "Enter an integer (12000 to end input): ";

cin >> numbers;

while (value != SENTINEL)

{

  fout << value << " ";

  cout << "Enter an value(12000,23000,10000 and 25000): ";

  cin >> data;

}

fout.close( );

file assert( ! fout.fail( ));

closing

return 0;

   }

}

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