Question: I need the C++ code for this assignment I need the c++ code to all 3 steps of this assignment Part I- Understand a Given

I need the C++ code for this assignment
I need the C++ code for this assignment I need the c++
code to all 3 steps of this assignment Part I- Understand a
Given Clast (die class) (40 pts) - Add proper epening cemments at
the beginning of the progam - Run the propam and answer the
following euestions. a. How many ebjects are creased in tha pracram fin
main Sunction?? - Weat is the name of each object? 9. What
in the face value of a die ebject on creation? Copy and
I need the c++ code to all 3 steps of this assignment
paite theie Qubt to the end of epening comment uecrion Part il
- Dse the die alass (60 pts) * Add a section of
code te the end of maind] function ty wnite the fela wing
tam copt itatements: [20 pts] Roll diet and diez for 2000 timet,
and compune the times thit twe de tus the sume values fie
Both are 1, or both are 2 , etc) Frint this court

Part I- Understand a Given Clast (die class) (40 pts) - Add proper epening cemments at the beginning of the progam - Run the propam and answer the following euestions. a. How many ebjects are creased in tha pracram fin main Sunction?? - Weat is the name of each object? 9. What in the face value of a die ebject on creation? Copy and paite theie Qubt to the end of epening comment uecrion Part il - Dse the die alass (60 pts) * Add a section of code te the end of maind] function ty wnite the fela wing tam copt itatements: [20 pts] Roll diet and diez for 2000 timet, and compune the times thit twe de tus the sume values fie Both are 1, or both are 2 , etc) Frint this court with a propes label - (20 ptw) Roll del and die2 as many times as needed, until the frest pair of 8 pecss. Print the count needed to get thit result. Don't forpet label your estaut. - 200 ptsi Roll diel and de2 for 2000 tient, and coenpute the times mhen the sum of teo dici is an even numberithe sum is 2 or 4 or 6 or or B. er 12). Frint this count eut with a proper tabel. Fart iii - Writing mystery dass (optional for eatra 20 points) Start a new pregram, ine it as Lab5Whisedyiterpfirithame1_finstane? 2 esp Wret the defintion ef a class that has the followine properati. The mame of the class is "nystecy" The clas myate ry has the two integer wariables, numt and num. The clas ayst efy has the followint member functiots. aet - ved d function to iet the values of nuat and num: thatyution hat 1 int parameten. PFint = wod dunation to output the values of nund and =m=2. cospute - value return function with one inceger parzeneter fay at io mam a walue as followe othetwise, teturn num1. - nue- +x Dtherwite tetuin falsin. Write the definitions of all member functions ef mpizery daut Write a protram with ad in i) to test ehe nonbery clati. Thin part you has the livedom to creati one or more mystery objectis) and ievole any puabic functions as your desire. Aut label your outpur sa that other people can underitand your ovtpst. comprimi Eagefie ff duehdit toelitalia H. Antisut Pf. Couraet cec-2sutid Hariti in wheh prepet latela in the dim dies. i) Copy and paste the eutput ta the ond po the aram anmin a puir at and of (asicocunantal Instructions: Submit to Blackboard one C++ file: salesAnalysis First NameLastName. 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: C:Itemp\inheritance_Lucinda_Jackson.cpp // 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: (20 pts) 1. I0 (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 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. tep 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: veid whetyquarter(salesersonlec list[]. Int listsize, 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: Int indexa Int garter Sint quarterif timet is "tietal oil 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: 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. The purpose ofthislaboratoryassignment is to introduce students to using and writing classes. Part I - Understand a Given Class (die class) (40 pts) - Download the die class, save it as Lab5UseDieClassFirstNameLastName.cpp - Add proper opening comments at the beginning of the program. - Run the program and answer the following questions: How many objects are created in this program (in main function)? What is the name of each object? What is the face value of a die object on creation? - Copy and paste these Q\&A to the end of opening comment section Part II - Use the die class ( 60 pts) - Add a section of code to the end of main() function by write the following two cout statements: int main () 1 II original code, are omitted here 11 ... cout Beginning of Part II " end1; II part II code goes here cout n Ending of Part II endl; return 0 ; - (20 pts) Roll die1 and diez for 2000 times, and compute the times that two die has the same values (ie. Both are 1 , or both are 2 , etc). Print this count with a proper label. - (20 pts) Roll die1 and die2 as many times as needed, until the first pair of 6 occurs. Print the count needed to get this result. Don't forget label your output. - (20 pts) Roll die1 and die2 for 2000 times, and compute the times when the sum of two dice is an even number(the sum is 2 or 4 or 6 or or 8 or 12). Print this count out with a proper label. Part III - Writing mystery class (Optional for extra 20 points) - Start a new program, save it as Lab5WriteMysteryFirstName1_FirstName2.cpp - Write the definition of a class that has the following properites: The name of the class is "mystery" The class mystery has the two integer variables, num1 and num2. The class mystery has the following member functions. set - void function to set the values of num 1 and num2; this function has 2 int parameters. print - void function to output the values of num1 and num2. compute - value-return function with one integer parameter (say x ) to return a value as follow: if x>0, return (num1 + num2) /2 otherwise, return num1 - num2 + x equal - value-return function with no parameter and returns true, if num1 equals num2. Otherwise return false. mystery - default constructor which sets num1 and num2 to 0 mystery - constructor with 2 parameters to set values to num1 and num 2 respectively - Write the definitions of all member functions of mystery class - Write a program with main () to test the mystery class. This part you have the freedom to create one or more mystery object(s) and invoke any public functions as your desire. But label your output so that other people can understand your output. comments. Example 1/ File Name: C: \temp\ArrayRange_Lucinda_Jackson.cpp 1/ Author: Lucinda A. Jackson 1/ Course: csc260L01 1/ Program Description: ... Be sure your description is very 1/ detailed and codes are indented correctly // questions and answers goes here Hand In: a) Copy the 3 questions from part I with your answers to the end of the opening comment section with proper labels in the die class. b) Write in the "Written submission" box, the contribution of each of the group member. Fail to do so, the one who submit the work will get 0 for this lab. c) Copy and paste the output to the end of the program within a pair of / and % (as comments) Save the finished program with all required comments as LabsUseDieClassFirstName1_FirstName2.cpp d) Upload only the cpp file to the Blackboard. Only one submission in each group. e) If you can finish part III, then upload the file form part III as well for getting extra points. Pair Programming in Groups of Two: The contributions of each group member must be provided. Members of the same group may receive different grades, based on the contributions breakdown and judged quality of these contributions. Write your contributions as comments at the top of your program. f The user progran that uses the class die void rol1() ffeunction to roll a dte. ffehis funetion uses a randon number generator to randonty I/generate a nuber between 1 and 6 , and stores the nuber Win the ingtance vartable nua. int getiln () const, If eunction to return the number on the top face of the dlle. freturns the value of the instence vartable nus. Privates 3 int num int mat(n() die diel; (1 caeate 2 die obdects dlet and dter dle dtez? cout ec -ale1. - se dies.gethun () se endi, cout e "dte2s " dlie2, gethun( ) end; Aes.roll(1): Ale2. xol(1) ) If print the values of dlet and dlez after the rolling cout \&e enfter rolling dle2: " dle2.gethun() e end,; cout se to the ou of the nubbers rolled" se - by the dlfee ist " + die2.gethuan() e endi, (1 roll diel and die2 again Ale1.5011(): dle2.rol1(): If what is the ous of two dice after this roll cout s Atter agatn rolling, the eun of . \&c "the numbers rolled ins. se diel.gethlun ()+ die2. gethan () se ead, return 0; 3/end maln Alestale(t) 1/1 construetor

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!