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

http://pastebin.ca/3372117 Program must use Bubble sorts. Either 3 x 1D (12) arr

ID: 3667523 • Letter: H

Question

http://pastebin.ca/3372117

Program must use Bubble sorts. Either 3 x 1D (12) arrary or 3x12 array (12 is because there are 12 salesmen ids) The sales data will be accumulated as entered into the program. Array 1)Sales ID Arrary2)Sales accumulator array Arrary3 (number of sales/counter for average

Salesman Sales & Salary (C++)

A company pays its salespeople on a commission basis. The salespeople each receive $200 per week plus 9 percent of their gross sales for the sales period. For example, a salesperson 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) determines for each salesperson their total sales, their salary and additional data points. There are 12 salesmen for the company. The data file is "SalesPerson SalesV3.txt". It contains the salesperson number (3 digit id) followed by his sales.   Each salesperson has numerous sales listed in the file for the period. You will need to keep up with the total number of sales and of course the total sales per salesman.

Output :

             1. Print out the Sales report showing the salesmen ID, his total number of sales, his total sales      
and his average per sale. Show the report in sorted ordered by Sales ID.

    2. Print out the same report but this time print out in sorted ordered by total sales.

    3. Print out the same report again sorted on average sales.

The company is being hit by Obama rules for businesses so we need to adjust our sales force. So I need to know which salesman had the smallest total sales. Print out the salesman, his total sales and percentage of his sales compared to the next worsted salesman. (Just to see how off his sales really are compared to one other.)

Explanation / Answer

Answer

#include <stdio.h>

#include<fstream.h>

using namespace std;

int main(void) {

                // your code goes herer

                //array decalaration of salesman

                int salesid[12],toalsales[12],addsal[12];

               

                //file reading here

                fstream infile;

                infile.open("E:/mywork/SalesPerson SalesV3.txt",ios_base::in);

                if (!infile)

                {

                cout<<"Error reading file!";

                return 0;

                }

                else

                {

                cout<<" Reading from file... ";

                //read data in before closing

                getline(infile,r_content);

                cout<<"The file contents are: ";

                cout<<r_content;

                string data = r_content;

                infile.close();

                }

                salesid[]=int(data)

                for(i=0;i<12;i++){

                    for(j=0;j<(12-1);j++){

                        if(salesid[j]>salesid[j+1]){

                          int temp;

                            temp=salesid[j];

                            salesid[j]=salesid[j+1];

                            salesid[j+1]=temp;

                        }

                    }

                }

                cout<<"sales array after bubble sort"<<endl;

                for(i=0;i<12;i++){

                    cout<<salesid[i]<<"";

                }

                int saleSalary;

                if totalsales >=5000; //calculate totalsales{

                    saleSalary =200+(totalsales*9/100);

                    cout<<"sales salary:"<<endl;

                }

                int avgsalary;

                avg salary = saleSalary/12;

                cout<<salesid<<endl;//here sales id changed thruogh bubble sort

                cout<<totalsales<<endl;

                cout<<avgsalary<<endl;

               

                return 0;

}