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

5210.0 sMitH,BoB 12000.0 joNes,ANAbel 800.0 thoMas,miCHaEl 25000.0 mILToN,mARTy

ID: 3610931 • Letter: 5

Question

5210.0 sMitH,BoB
12000.0 joNes,ANAbel
800.0 thoMas,miCHaEl
25000.0 mILToN,mARTy

#include<iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;

const int SIZE = 25;//Size of arrays

int main()
{
double SalesAmounts [SIZE]={0.0}; //Sales amounts array
string SalesReps [SIZE]; //Names of sales representativesarray
ifstream infile; //Input filestream variable
string fnameopen, fnameclose; //Variables to hold actualname of file
double sum;
int counter=0; //used in for loops
double average; //average of sales amount
int MaxIndex; //used to find the array with the largestvalue
double LargestSale; //variable to hold the largestvalue

cout<<"Pleaseenter name of input file"<<endl;
cin>>fnameopen;
infile.open(fnameopen.c_str());
cout<<"Please enter name of outputfile"<<endl;
cin>>fnameclose;
cout<<"Hubbard Payroll Summary forNewTech"<<endl;

intnumElements=counter-1;

for(int i=0; i<counter;i++)
    {
      string s= SalesReps[i];
      for( int j = 0; s[j]; j++)
        s[j] =tolower(s[j]);

      intt=s[0];
      if((t>=97) && ( t<=122))
        {
          c= t-32;
          s[0]=c;
        }

     SalesReps[i]=s;

    }

average = sum/counter;
cout<<fixed<<showpoint<<setprecision(2);
cout<<"Average sales: "<<setw(8)<<"$"
     <<setw(10)<<average<<endl;

cout<<"Highest sales total:"<<setw(2)<<"$"<<setw(10)
      <<LargestSale<<endl;
cout<<"Name of sales person with the highest salesamount: "<<SalesReps[MaxIndex]<<endl;

//////////median salesamount
//cout<<"NUMELEMENTS:"<<numElements;

for(int p =1; p<numElements;p++)
    {
      for(int q=0; q<p;q++)

        {
         if(SalesAmounts[q] > SalesAmounts[p])
           {
             double temp=SalesAmounts[q];
             SalesAmounts[q]= SalesAmounts[p];
             SalesAmounts[p]= temp;
           }
        }
    }

if(numElements %2==0)
    {


      cout<<"Median sales amount:"<< ( SalesAmounts[(numElements/2)-1] +SalesAmounts[(numElements/2)])/2 <<endl;
    }
else
    {
      int median =(numElements/2);
      cout<<"Median sales amount:"<<SalesAmounts[median]<<endl;

    }


return 0;
}

Explanation / Answer

please rate - thanks #include #include #include #include using namespace std; double findaverage(double[],int); double findmedian(double[],string[],int); double findbig(double[],int,int &); void switchit(string[],int); const int SIZE = 25; //Size of arrays int main() { double SalesAmounts [SIZE]={0.0}; //Sales amounts array string SalesReps [SIZE]; //Names of sales representativesarray ifstream infile; //Input filestream variable string fnameopen, fnameclose; //Variables to hold actualname of file double sum; int counter=0; //used in for loops double average; //average of sales amount int MaxIndex; //used to find the array with the largestvalue double LargestSale; //variable to hold the largest value int loc; double median; int numElements; cout
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