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, 21.06.2019 23:00
What is one of the main problems that can occur when implementing a large number of new systems within an organization?
Answers: 1
question
Computers and Technology, 22.06.2019 13:30
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
question
Computers and Technology, 22.06.2019 22:30
Jason needs to learn a new web tool. he went through his books to understand more about it. now he wants hands-on experience with using that tool. what would him? jason can use websites where workspace is provided to test the results of your code.
Answers: 2
question
Computers and Technology, 23.06.2019 17:00
What are the 12 colors of the spectrum called?
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
World Languages, 20.01.2021 22:00
question
Mathematics, 20.01.2021 22:00
question
Arts, 20.01.2021 22:00
question
Biology, 20.01.2021 22:00
question
SAT, 20.01.2021 22:00
Questions on the website: 13722363