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

Salesman Sales & Salary - C++ Note: Can only use arrays and functions A company

ID: 674595 • Letter: S

Question

Salesman Sales & Salary - C++

Note: Can only use arrays and functions

A company pays its salespeople on a commission basis. The salepeople each receive $200 per week plus 9 percent of their gross sales for the sales period. For example, a saleperson who grosses $5000 in sales in the period receives $200 plus 9 percent of $5000, or a total of $650. Write a program (using an array of counters and accumulators) that determines for each salesperson their total sales and their salary. There are 10 salesmen for the company.
The data file is: http://pastebin.com/mT5KPGdv
It contains the salespersons number (1-10) follows by his sales. Each salesperson has numerous sales listed.

Use separate functions for mostly everything.

Print out each saleman's number, their total sales and their salary for the givecn period in a nice table format. Also print out the total number of sales and the average sales each salesman made. I also need to know which salesman was my lowest producer.
The columns must be lined up in a nice table format.
Example (or something like this):

      Salesman       Salary         Average         Sales Count

Explanation / Answer

I submitted the code for you. If you have any further queries, just ping me so that I can help you on that.

#include <iostream>
#include <iomanip>
#include <fstream>
using namespace std;
int main()
{
string fileName;
float sales[10], currentSale;
int numberOfSales[10], EmpID;
ifstream input_file;
cout<<"Enter the input file name: ";
cin>>fileName;
input_file.open(fileName);
for(int i = 0; i < 10; i++)
{
sales[i] = 0;
numberOfSales[i] = 0;
}
while(!input_file.eof())
{
input_file>>EmpID>>currentSale;
cout<<"EmpID: "<<EmpID<<" Sale: "<<currentSale<<endl;
sales[EmpID - 1] += currentSale;
numberOfSales[EmpID - 1]++;
}
cout<<"Salesman Salary Average SalesCount"<<endl;
for(int i = 0; i < 10; i++)
{
cout<<i+1<<" $"<<fixed<<setprecision(2)<<(200+sales[i]* 0.09)<<" "<<fixed<<setprecision(2)<<(sales[i]/numberOfSales[i])<<" "<<numberOfSales[i]<<endl;   
}
  

}

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