subject

A company sells software products. It keeps a record of the number of products that were sold by an employee for a particular month in a calendar year. Write a function, readSales to read the txt file and store the name and sales in two separate arrays. The function returns the number of employees stored. Function specifications: • The function name: readSales • The function parameters (in this order): O A file name of type string O An array of type string to store names of employees 0 A 2D integer array with 12 columns to store sales of employees o The size of the array as an int The function returns an integer depending on the following conditions o It returns - 1 if the file cannot be opened. o It returns the number of employees stored in the array if the function can open and read the file o It returns the size of the array (the capacity of the string array or the number of rows in the 2D array) if the arrays are full. Sample file (sales. txt): vipra 60, 80, 50, 70, 85, 32, 94, 81, 45, 65, 91, 82 Chandan 1, 25, 18, 22, 23, 16, 5, 33, 21, 27, 23, 102 Malvika 55, 54, 52, 56, 58, 52, 51, 59, 58, 50, 54, 55 Sample run 1 (bold is user input) | Enter the file name: sales. txt Returned value (number of employees): 3 Names [0] = Vipra sales[0][0] = 60 sales[0][1] = 80 es[0][2] = 50 sales ro131 = 70 [O] [4] = 85 [O] [5] = 32 s[0][6] = 94 es [0] [7] = 81 les [0] [8] = 45 | | LO Lot | | | sales [0] [9] = 65 sales [0] [10] = 91 sales [0] [11] = 82 The file should be named as sales. cpp. Don't forget to head over to the code runner on Moodle and paste only your function in the answer box! In the main, make sure that you call the function and output the return value. Extra Credit 5 pts in the main, print out the average scores of hmwk for each student. Sample run 2 (bold is user input) Enter the file name: sales. txt Returned value (number of employees): 3 Vipra: 69.58 Chandan: 26.33 Malvika: 54.50

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Quick pl which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 23.06.2019 15:30
Write a program in plp assembly that counts up by one starting from zero (or one) inside a loop and writes this value to the leds every time the value is increased. the memory address of the leds is 0xf0200000. the table below shows the meaning and an example usage of the instructions covered in the video, plp instructions for project 1. instruction example usage meaning load immediate li $t0, 8 register $t0 is set to the value, 8. store word sw $t2, 0($t1) the value in register $t1 is used as the memory address. the value in register $t2 is copied into this memory address. add addiu $t4, $t3, 29 register $t4 is assigned the sum of 29 and the value in register $t3. jump j your_label_name the program jumps to the line following the label, "your_label_name: ". label your label name: defines a label called "your_label_name: " that can be jumped to
Answers: 2
question
Computers and Technology, 23.06.2019 15:30
1. ask the user how many questions are in the quiz. 2. ask the user to enter the key (that is, the correct answers). there should be one answer for each question in the quiz, and each answer should be an integer. e.g., 34 7 13 100 81 3 9 10 321 12 might be the key for a 10-question quiz. you will need to store the key in an array. 3. ask the user to enter the answers for the quiz to be graded. there needs to be one answer for each question. note that these answers do not need to be stored; each answer can simply be compared to the key as it is entered. 4. when the user has entered all of the answers to be graded, print the number correct and the percent correct. 5. add a loop so that the user can grade any number of quizzes with a single key. after the results have been printed for each quiz, ask "grade another quiz? (y/n)." note: you only have one array (the key). you are not creating a new key for each set of quiz answers.
Answers: 3
question
Computers and Technology, 23.06.2019 16:00
Which analyst position analyzes information using mathematical models to business managers make decisions?
Answers: 1
You know the right answer?
A company sells software products. It keeps a record of the number of products that were sold by an...
Questions
question
Mathematics, 18.02.2021 01:40
question
Mathematics, 18.02.2021 01:40