swappatil2611
BAN USER
0 Answers C# Question
Consider this C# Program. It reads lines from the standard input and and does some processing on them by calling processData.
- swappatil2611 September 03, 2020
The input is being read in from a file called input.txt, in this format:
22, Data Structures, 45
23, English, 52
22, English, 51
26, Data Structures, 72
23, Data Structures, 61
24, English, 81
Each line consists of three fields "Student ID," "Subject," and "Marks." "Student ID" and "Marks" are integers and "Subject" is a string that does not contain commas or newlines. There can be any number of students and up to 6 subjects.
Currently, the existing program reads the input, puts it into a data-structure, and calls a function/method processData on it. processData returns an integer that is printed to the output file. Unfortunately, processData currently does not do anything useful - it just returns 0.
You have to modify processData to compute the average marks scored across all subjects by the student with the lowest ID.
If your program is run with the input given above, it should print 48 because that is the average of the marks received by the student with ID 22 (which is the lowest ID).| Flag | PURGE
Open Chat in New Window