Question: Need help on this C++ Code assignment, if you help thank you so much!!! (Also attached the 2 txt files) Step 1: Download two data

Need help on this C++ Code assignment, if you help thank you so much!!! (Also attached the 2 txt files)

Need help on this C++ Code assignment, if you help thank youso much!!! (Also attached the 2 txt files) Step 1: Download twodata files: The sales persons' ID file and the company's sales datafile. (5 pts) Step 2: we will define a struct with salesdata: (20 pts) 1. ID (string) // sales persons ID number. 2.

Step 1: Download two data files: The sales persons' ID file and the company's sales data file. (5 pts) Step 2: we will define a struct with sales data: (20 pts) 1. ID (string) // sales persons ID number. 2. saleByQuarter[4] (double) // array of sale amount for each quarter 3. totalSale (double) // the total amount for the year ***** Use salesPersonRec as the struct name. Step 3: (20 pts) 1. Write a function getID(). The getID() is a void function with 2 parameters(an array of salesPersonRec and its size). This function will: a. declare an ifstream variable: inFile b. open the sale persons' ID file and check for opening error c. read the file and store the IDs into the salesPersonRec[i].ID. To simplify the program, we assume that we know there are only 6 sale persons in the company. You can define a const int NO_OF_SALES_PERSON = 6 after "using namespace std" statement. d. Initialize all other field to 0.0 e. Close the file f. for debugging, you can print all ID's out. But remember to delete the code after you get it done correctly. g. In the main() function, i. Declare an array of salesPersonRec (data type) of size NO_OF_SALES_PERSON ii. Call getID() function by passing the array and its size to it. Step 4: (20 pts) 1. Write a function getData(). The getData() is a void function with 2 parameters(an array of salesPersonRec and its size). This function will: a. declare an ifstream variable: inFile b. open the sales data file \& check for opening error c. read the ID and store it into firstNameID while (inFile) \{ -read in month and amount -search the array for firstNameID. Break if found the ID -check the month and determine which quarter to add the amount. You can use either if statement or switch statement for this part. -add the amount to the calculated quarter End-of-while-loop d. close the file e. for debugging, you can print all data out. But remember to delete the code after you get it done correctly. f. In the main() function, call getData() function by passing the array and its size to it. Step 5: (10 pts) 1. Write a function saleByQuarter(). The saleByQuarter () is a void function with 3 parameters(an array of salesPersonRec, its size, and an array of double totalSalesByQuarter[4]). We don't need to pass the size of the 3rd array. Its will be always equal to 4 . This function will: a. Add the total amount of a specific quarter of all sale persons and store the final result into the correspondent spot in the totalSalesByQuarter[] array b. In the main() function, -Call saleByQuarter () function by passing the array, its size and the totalSalesByQuarter[] array This function is provided for you as the follows: .Step 6: (5 pts) 1. Write a function printReport(). The printReport() is a void function with 2 parameters(an array of salesPersonRec and its size). This function will: a. Print a title: "--------- Annual Sales Report b. Print sale person's ID, the amount for each quarter, and total for the sale person with header. Each sale person's data is printed in one row c. Print the total of each quarter from all sale persons This function is provided for you as the follows: void printReport(salesPersonRec list [] , int listSize, d. In the main() function, call printReport() function by passing the array and its size to it. Step 7: (15 pts) 1. Write a function maxSaleByPerson(). The maxSaleByPerson () is a void function with 2 parameters(an array of salesPersonRec and its size). This function will: a. declare a maxindex and initialize it to 0 b. declare an index; c. Use a for loop to traverse through the entire "salesPersonRec" array and find out the person who has the most sales. d. Print out the person's ID who generates the maximum sale for the year and the sales amount. Use the sample output as your guideline. e. In the main() function, i. Call maxSaleByPerson () function by passing the array and its size to it. Step 8: (5 pts) 2. Write a function maxSaleByQuarter(). The maxSaleByQuarter () is a void function with 1 parameters(an array of double, called totalSalesByQuarter[]). This function will: a. declare a maxindex and initialize it to 0 b. declare an index; c. Use a for loop to traverse through the entire "totalSalesByQuarter" array and find out the largest sales. You can just loop it 4 times d. Print out the quarter number and the amount. Use the sample output as your guideline. e. In the main() function, i. Call maxSaleByQuarter () function by passing the array to it. Sample Output: 123453221423422573733586454654

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!