1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <iostream>
#include <string>
#include <iomanip>
using namespace std;
//Function Protypes
void displayTotalSales(double & s1, double & s2, double & s3, double & s4);
void calcSum(double & s1, double & s2, double & s3, double & s4);
void calcCommission(double & s1, double & s2, double & s3, double & s4);
void displayTotalCommission(double & s1, double & s2, double & s3, double & s4);
//Begin Program
int main()
{
double s1 = 0;
double s2 = 0;
double s3 = 0;
double s4 = 0;
displayTotalSales(s1, s2, s3, s4);
cout << "The Total Sales Amounts: ";
calcSum(s1, s2, s3, s4);
cout << "1: " << s1 << endl << "2: " << s2 <<endl << "3: " << s3 <<endl << "4: " << s4 <<endl;
calcCommission(s1, s2, s3, s4);
displayTotalCommission(s1, s2, s3, s4);
return 0;
}
//Begin dispalyTotalSales Function
void displayTotalSales(double & s1, double & s2, double & s3, double & s4)
{
cout << "Enter Sales Amounts: ";
cin >> s1 >> s2 >> s3 >> s4;
}
//End Function
//Begin calcSum Function
void calcSum(double & s1, double & s2, double & s3, double & s4)
{
cout << s1 + s2 + s3 + s4 << endl;
}
//End Function
//Begin CommissionPercentage Function
void calcCommission(double & s1, double & s2, double & s3, double & s4)
{
cout.precision(5);
int Commission = (s1 + s2 + s3 + s4) * .10;
}
//End Function
//Begin displayTotalCommission Function
void displayTotalCommission(double & s1, double & s2, double & s3, double & s4)
{
cout.precision(5);
cout << "The Total Commission Amount is: $";
cout << ((s1 + s2 + s3 + s4) * .10) + s1 + s2 + s3 + s4 << endl;
//End Function
system ("pause");
}
//End Program
|