Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the C++ CODE FOR this assignment all 9 steps Instructions: Submit to Blackboard one C++ file: salesAnalysis_FirstNameLastName. cpp. The code in the file

I need the C++ CODE FOR this assignment all 9 steps
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Instructions: Submit to Blackboard one C++ file: salesAnalysis_FirstNameLastName. cpp. The code in the file must include your name, the course, the file name (the full path name) and the program description in comments. Example // File Name: Ciltemp\inheritance_Lucinda_Jackson,cpp 1// Author: Lucinda A. Jackson // Course: CSC-260L-01 // Program Description:... 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: ( 20pts) 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 firstNomelD 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 parammeters(an array of salesPersonRec, its size, and an array of double totalSalesByQuarter[4]). We don't need to pass the size of the 3td 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: vold salefpquarter (ulespersongec 1ist[], int 1istsine, Int puirtery Int index; for (ewarten = of quarter ( 4) puarteret) totalbourter quarter ]=0.0. for (quarter = oj suarter ( A) qaarterit) for (index o of infer ( listsisei indexpe) titaleyoucter [quarter] o Disi[intex) isalebyouarter [quarterli 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: veid printhepert(salespirsontec list[), int listsize, int index; int quartery for (incex = e) Index ( IIstsile) indexi+) ( cout if list [inder).10 \&t = if fer (quarter = oj quarter i if warterta) cout 4setn(10) ct ilst[index].ulebyouarter quarter li cout id setir(1e) it Iist ( inder )+ totalsale if endi reut it "Tetal of for (emartar in ej quarter \& 4y quarterte) redt af setiofie) ic salebyquarter [quarter)d ceut if end (\& endi) ) / /end printherourt. d. In the main() function, call printReport() function by passing the array and its size to it. 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. 2. ( Write a 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: fux sale by Saleipersen: to 53373, Aoount 410619.00 Mux sale by coirter: Quarter =3, Amount 518743,00 Trexess exited ofter 0.3366 seconds with return value 0 Press any key to continue... Step 9: 1. Copy and paste your output to the end of the driver program as "comments" and turn it in. 2. Submit the source file to the Blackboard assignment link. 1 Sine 3. Fas ptif 3. npenthe aely arroser? Cose ithe fie pu Bert e divin oonnity c. With mene hun lom. 5sap4. pol ptu] c. mext itw is and there in inte burkens while Infinifi reat in the thand amiat tadef in 4. dime the Mie pudent ed dine nom wery. tod in inuth and eitobrit 2 of 3 1. 4ienet ine the Sils 3 iat jtil B. in ber maxb furitiot. tutukienthaverter airar. Mre ti firsi Simpe ? iab pest b. declas an inder: broin whe fai the fori ipler. 4. inter maish hurbise hare 7 iss pesil b. declain eh endery, 4. peiven mis hai the minilitis. 4. In the masi fuabous. Muse fis etr B Heclaen an mates 4. In intu mainil furction. Sumpin Curpat Barit 7

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions

Question

Describe Public HRM Reforms

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago