As the manager of Sunshine Hot Tubs you would like to create

As the manager of Sunshine Hot Tubs, you would like to create a report that tracks the sales of your employees. You currently have three sales people – Reid, Jarid, and Nicole. Write a program that prompts the user for a salesperson’s initial (‘R’, ‘J’, or ‘N’) then allows the user to enter up to 4 sale amounts at a time for the salesperson. Calculate and display the salesperson’s commission as 13% of the sales entered. Add the commission to a running total for that salesperson. The program should terminate when the user types a ‘Z’. A final report should display each salesperson’s total commission earned along with their average sales.

Additional information: Up to 4 sales may be entered for the employee’s more than once. Your final report should include the total sales for all of the entries made for the employee. For example, Reid may have 2 sales, then Nicole with 3 followed by Reid again with 4 sales. Final output for Reid would the total of his 6 sales. Your program should efficiently implement all 3 of the looping constructs. Implement shortcut operators where appropriate. Your program should handle invalid entries for the salesperson’s initials. Once a valid salesperson’s initial has been entered, the program should continue prompting the user for a valid number of sales - (no negative values or values exceeding the limit of 4 sales entries per salesperson at a time). Output should be in a report format labeled, aligned, and formatted to 2 decimal places. Break; statements may only be implemented in switch statements; not in if or looping statements, No continue; statements. Make sure you are using the correct data types and descriptive variable names. Do not use arrays in your code. Add a comment to the top of your program that includes your name, the program name, and a description of the program code. Include descriptive comments throughout your program. Test your calculations!

Solution

#include<iostream>
using namespace std;

double check(double,double);
double addr,addn,addj;
double aar, aan, aaj;
double calc(char c)
{
   double s1, s2, s3, s4, add;
   double ss1, ss2, ss3, ss4;
  
   cout << \"Enter sales amount 1: \";
   cin >> s1;
   s1=check(s1,1);
   ss1 = s1*0.13;

   cout << \"Enter sales amount 2: \";
   cin >> s2;
   s2 = check(s2,2);
   ss2 = s2*0.13;

   cout << \"Enter sales amount 3: \";
   cin >> s3;
   s3 = check(s3,3);
   ss3 = s3*0.13;

   cout << \"Enter sales amount 4: \";
   cin >> s4;
   s4 = check(s4,4);
   ss4 = s4*0.13;

   add = ss1 + ss2 + ss3 + ss4;
   if (c == \'r\')
   {
       addr = (s1 + s2 + s3 + s4) / 4;
       aar = addr;
       aar = aar + addr;
   }
   else if (c == \'j\')
   {
       addj = (s1 + s2 + s3 + s4) / 4;
       aaj = addj;
       aaj = aaj + addj;
   }
   else if (c == \'n\')
   {
       addn = (s1 + s2 + s3 + s4) / 4;
       aan = addn;
       aan = aan + addn;
   }

   return add;
}

double check(double s,double num)
{
   if (s < 0)
   {
       double ss;
       cout << \"No negative values allowed\" << endl;
       cout << \"Enter sales amount \" << num << \": \";
       cin >> ss;
       return ss;
   }
   else
       return s;
}

int main()
{
   char name;
   double ansr = 0.0, ansj = 0.0, ansn = 0.0;
   double ar=0, aj=0, an=0;
   cout << \"\\t\\t\\tSunShine Hot Tubs\\t\\t\\t\"<<endl;
   do
   {
       cout << \"Enter the initial of the salesperson: \";
       cin >> name;
       if (name == \'R\')
       {
           ansr=calc(\'r\');
           ar = ansr+ar;
       }
       else if (name == \'J\')
       {
           ansj=calc(\'j\');
           aj = ansj + aj;
       }
       else if (name == \'N\')
       {
           ansn=calc(\'n\');
           an = ansn + an;
       }
       else
           cout << \"Invalid Initial.. Try again!...\"<<endl<<endl;
   } while (name != \'Z\');
   cout << \"---------------------------------------------------------------------\"<<endl;
   cout << \"SalesPerson\\t\\tTotal Commission Earned\\t\\tAverage\\t\\t\" << endl;
   cout << \"---------------------------------------------------------------------\" << endl << endl;
   cout << \"Reid\\t\\t\\t\\t\"<<ar<<\"\\t\\t\"<<aar<<endl;
   cout << \"Jarid\\t\\t\\t\\t\" << aj << \"\\t\\t\"<<aaj<<endl;
   cout << \"Nicole\\t\\t\\t\\t\" << an << \"\\t\\t\"<<aan<<endl;
   cout << \"---------------------------------------------------------------------\"<<endl;
   system(\"pause\");
   return 0;

}

As the manager of Sunshine Hot Tubs, you would like to create a report that tracks the sales of your employees. You currently have three sales people – Reid, Ja
As the manager of Sunshine Hot Tubs, you would like to create a report that tracks the sales of your employees. You currently have three sales people – Reid, Ja

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site