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

Please Use C++ as programming language but I need the program to be divided into

ID: 3817896 • Letter: P

Question

Please Use C++ as programming language but I need the program to be divided into header and source file (.h and .cpp) (Use Visual Studios) Thank you!

(Salary Classification) A company pays its a on a commission basis. The salespeople each salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $5000 in sales in a week receives $200 plus 9 percent of$5000,or a total of $650. Write a program (using an array of counters that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer amount): a)$200-299 b)$300-399 c)$400-499 d) $500-599 e) $600-699 $700-799 g) $800-899 h) $900-999 i) $1000 and over.

Explanation / Answer

#include<iostream>
#include<cmath>
#include<string>
using namespace std;

//declare variable to hold 9% of their gross
const double percent = 0.09;
const int weekly_pay = 200;
int main()
{
   double gross_earned,total_earning;
   int c,count = 0;
   //declare array of integer for counting number of salesperson in particular range ,size of arraya as 8 because there are 9 ranges
   int range[9] = { 0 };
   //declare array of string for displaying appropriate message for each range
   string range_msg[10] = { "200-299", "300-399", "400-499", "500-599", "600-699", "700-799", "800-899", "900-999", "1000 and over" };
   do
   {
       cout << "Enter the salesperson gross sale: ";
       cin >> gross_earned;
       //calculate total_earning = gross_earned + gross_earned*percent ;
       total_earning = weekly_pay + gross_earned*percent;
       if ((int)total_earning >= 200 && (int)total_earning <= 299)
       {
           ++range[0];
       }
       if ((int)total_earning >= 300 && (int)total_earning <= 399)
       {
           ++range[1];
       }
       if ((int)total_earning >= 400 && (int)total_earning <= 499)
       {
           ++range[2];
       }
       if ((int)total_earning >= 500 && (int)total_earning <= 599)
       {
           ++range[3];
       }
       if ((int)total_earning >= 600 && (int)total_earning <= 699)
       {
           ++range[4];
       }
       if ((int)total_earning >= 700 && (int)total_earning <= 799)
       {
           ++range[5];
       }
       if ((int)total_earning >= 800 && (int)total_earning <= 899)
       {
           ++range[6];
       }
       if ((int)total_earning >= 900 && (int)total_earning <= 999)
       {
           ++range[7];
       }
       if ((int)total_earning >= 1000 )
       {
           ++range[8];
       }
       count++;
       cout << "Want to continue entering gross of salespesron:(y/n?): ";
       fflush(stdin);
       c = getchar();
   } while (c !='n');

   for (int i = 0; i < 9; i++)
   {
       cout << range_msg[i] << ": " << range[i] << endl;
   }

}

--------------------------------------------------------------------------------------------------------------------

//output

Want to continue entering gross of salespesron:(y/n?): y
Enter the salesperson gross sale: 8996
Want to continue entering gross of salespesron:(y/n?): y
Enter the salesperson gross sale: 4000
Want to continue entering gross of salespesron:(y/n?): 3560
Enter the salesperson gross sale: Want to continue entering gross of salespesron
:(y/n?): y
Enter the salesperson gross sale: 9890
Want to continue entering gross of salespesron:(y/n?): y
Enter the salesperson gross sale: 1248
Want to continue entering gross of salespesron:(y/n?): y
Enter the salesperson gross sale: 8978
Want to continue entering gross of salespesron:(y/n?): y
Enter the salesperson gross sale: 10000
Want to continue entering gross of salespesron:(y/n?): n
200-299: 1
300-399: 2
400-499: 0
500-599: 1
600-699: 0
700-799: 1
800-899: 1
900-999: 1
1000 and over: 4

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