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, 22.06.2019 18:30
Which of the following commands is more recommended while creating a bot?
Answers: 1
question
Computers and Technology, 23.06.2019 06:20
What is a point-in-time measurement of system performance?
Answers: 3
question
Computers and Technology, 23.06.2019 11:30
Me dangers of social media and the internetexplain what each means: 1) social media and phones have become an addiction.2) outside people have access to you all the time.3) cyberstalking4) cyberbullying5) catphishing6) viruses7) identity theft8) credit card fraud9) hacking10) money schemes
Answers: 1
question
Computers and Technology, 23.06.2019 12:00
What does the level 1 topic in a word outline become in powerpoint? a. first-level bullet item b. slide title c. third-level bullet item d. second-level bullet item
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, 23.03.2020 07:29
question
Mathematics, 23.03.2020 07:30
question
Mathematics, 23.03.2020 07:34
question
Chemistry, 23.03.2020 07:35
Questions on the website: 13722360