Question
NOTE: No arrays should be used to solve problems and No non-constants global variables should be used. PART B: (Statistics Program) (50%) Please read this
NOTE: No arrays should be used to solve problems and No non-constants global variables should be used.
PART B: (Statistics Program) (50%) Please read this lab exercise thoroughly, before attempting to write the program. Write a program that reads the pairs of group number and student count from the text file (user must enter name of file) and:
1. Displays the number of groups in the file (5 %)
2. Displays the number of even and odd student count (5%)
3. Displays the sum of the even student count and the sum of the odd student count as well as the sum of all the student count (5%)
4. Displays the group numbers of the largest student count and the smallest student count (5 %)
5. Computes the average of the largest and smallest student count (10 %)
6. Compute the sum of ALL the digits in the largest student count (i.e. 952 Sum is 9+5+2 = 16) (15 %)
Assume the contents of the file are as follows but that the pairs of data can change later:
1 25
2 123
3 475
4 61
5 77
6 910
7 234
8 138
9 134
10 95
11 674
12 345
13 31
14 211
15 952
16 873
17 22
18 7
19 876
20 347
21 450
The following is a sample output:
What is name of the input file? integers.dat
The number of groups in the file is 21
There are 12 odd student count and 9 even student count
The sum of the odd student count is 2645
The sum of the even student count is 4390
The sum of all the student count is 7035
The group number of the largest student count is 15
The group number of the smallest student count is 18
The average of 952 and 7 is 479.5
The sum of all the digits in the largest student count is 16
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started