Computers and Technology

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

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 21:30, willwhitlock803
Write code using c . (take input from user) calculate the size of a given file in kbs. in this task you will complete the function with the following prototype: float get_file_size(char * filename); the function takes the file name (address to the start of a null terminated character array) as input. the function should then open the file and find the number of bytes it contains till eof. the number of bytes divided by 1024 will give the size in kbs. if the file cannot be opened the function should return -1.
Answers: 2
image
Computers and Technology, 23.06.2019 16:50, lukeakalucas
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
image
Computers and Technology, 23.06.2019 22:30, reaganphelps3
What would be the address of the cell, which is at the intersection of the second row and the third column in a worksheet?
Answers: 1
image
Computers and Technology, 24.06.2019 08:00, Maxxboogie
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
Do you know the correct answer?
A company sells software products. It keeps a record of the number of products that were sold by an...

Questions in other subjects:

Konu
Mathematics, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01
Konu
Social Studies, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01
Konu
Health, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01
Konu
Mathematics, 18.09.2020 02:01