There are now 10 sales associates working for the Roadrunner Automobile Club (RA
ID: 3697984 • Letter: T
Question
There are now 10 sales associates working for the Roadrunner Automobile Club (RAC) of Boulder Colorado. Their manager needs a program to allow her to analyze the sales associates' performance over the last 6 months. The program needs to generate the following report :
RAC 6 Month Sales Associate Performance Report
Associate Jan Feb Mar Apr May June Sign-up Average
Volmer 88 90 177 172 180 194 150
Wilson 191 213 276 288 305 320 266
Mandich 270 299 302 325 376 401 329
Pinto 109 132 150 167 178 189 154
McMahon 122 127 143 155 168 188 151
Miller 95 102 110 238 128 155 138
Hemple 34 53 54 38 92 97 61
Bonner 86 56 101 124 136 144 108
Sayers 153 134 142 141 185 192 158
Franks 56 62 77 83 90 93 77
6 month average 159
Above average performers :
Wilson
Mandich.
Hierarchy Chart
Name 6 mo. Signup avg
Mandich 329
Wilson 266
Sayers 158
Pinto 154
McMahon 151
Volmer 150
Miller 138
Bonner 108
Franks 77
Hemple 61
In C++ Use 3 arrays : a one-dimensional arrays to store the sales associates names, a (parallel) two-dimensional array to store the sign-up counts, and a parallel one-dimensional array to store the 6 month average of each associate. The program must contain at least the following functions : a function to read and store data into two arrays, a function to calculate the 6 month average of each associate, functions to output the results and a function to sort the array of 6 month averages
Explanation / Answer
#include <iostream>
#include <string>
using namespace std;
const int noOfPersons=10;
const int noOfMonths=6;
void readData(string names[noOfPersons],int sales[noOfPersons][noOfMonths])
{
for(int i=0;i<noOfPersons;i++)
{
cout<<"enter name: ";
cin>>names[i];
}
for(int i=0;i<noOfPersons;i++)
{
for(int j=0;j<noOfMonths;j++)
{
cout<<"Enter sales of "<<names[i]<<" : ";
cin>>sales[i][j];
}
}
}
void calSales(int sales[noOfPersons][noOfMonths],double avgSales[noOfPersons])
{
for(int i=0;i<noOfPersons;i++)
{
for(int j=0;j<noOfPersons;j++)
{
avgSales[i]+=sales[i][j];
}
avgSales[i]/=noOfMonths;
}
}
void display(string names[noOfPersons],double avgSales[noOfPersons])
{
cout<<"Avg sales Details:";
for(int i=0;i<noOfPersons;i++)
{
cout<<endl<<names[i]<<" "<<avgSales[i];
}
}
void sortSales(double avgSales[noOfPersons])
{
for(int i=0;i<noOfPersons;i++)
{
for(int j=0;j<noOfPersons;j++)
{
double tmp;
if(avgSales[i]<avgSales[j])
{
tmp=avgSales[i];
avgSales[i]=avgSales[j];
avgSales[j]=tmp;
}
}
}
}
int main()
{
string names[noOfPersons];
double avgSales[noOfPersons];
int sales[noOfPersons][noOfMonths];
readData(names,sales);
calSales(sales,avgSales);
sortSales(avgSales);
display(names,avgSales);
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.