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 11:00
What are the possible consequences of computer hacking? what is computer piracy? describe some examples. what are the effects of computer piracy? what are the possible consequences of computer piracy? what is intentional virus setting? describe some examples. what are the effects of intentional virus setting? what are the possible consequences of intentional virus setting? what is invasion of privacy? describe some examples. what are the effects of invasion of privacy? what are the possible consequences of invasion of privacy? what is an acceptable use policy and what is the purpose of the acceptable use policy what is intellectual property and how can you use it?
Answers: 1
question
Computers and Technology, 25.06.2019 05:00
Which of the following statements best deceive the relationship between carrying capacity and population size
Answers: 1
question
Computers and Technology, 25.06.2019 13:00
Involves gauging oneself against the achievements of peers. self-fulfilling prophecy. social comparison. indirect evidence. self-concept.
Answers: 1
question
Computers and Technology, 25.06.2019 16:00
Nasa’s long term goal is for travel in space to be as as travel across the atlantic. however, we are away from that.
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, 27.04.2021 21:30
question
Medicine, 27.04.2021 21:30
question
Mathematics, 27.04.2021 21:30
question
English, 27.04.2021 21:30
question
English, 27.04.2021 21:30
question
Mathematics, 27.04.2021 21:30
question
Mathematics, 27.04.2021 21:30
question
Chemistry, 27.04.2021 21:30
Questions on the website: 13722361