Question: I was wondering how to do this program: Lab- 1 Objective: The purpose of this project is to expose you to: Loops, input/output, summation, maintenance
I
was wondering how to do this program:
Lab- 1
Objective:
The purpose of this project is to expose you to:
Loops, input/output, summation, maintenance and file processing.
Problem Specification:
The attached file data.txt, contains a class data that consists of an id numbers and a test scores for each of the students in a class. We dont know the number of students in the class and must use 0 as sentinel.
Write a function that reads the data from the file until 0 is encountered for the id number, counts the number of students and finds the average of the test not including 0. At this point you must close the file.
Write a second function that prints the average calculated in the previous function, opens the same file again, reads the id and score for each of the students in the file using the counter from the previous function. Further this function will call another function that will write to a file, the id number, the score, and a message stating whether the score is below the class average, is equal to the class average or above the class average.
Requirements:
The id is an integer whereas the score may be an integer, a float or a double.
The first function above uses a while or a do loop.
The second function uses a for loop.
Every function has detailed specifications.
The function main () does not do any processing, its used as a driver function for the program.
Output is sent to a file.
Sample output:
CIS Department Fall 2018
CIS 160 Test Analysis
The class average in this test is = 70.00
Student Test Score Message
1234 82.67 above Average
2134 76.00 is Equal to average
3124 46.33 below average
.
.
.
.
.
End of class analysis
Grading Criteria:
5 points there are sufficient comments at the start of the program.
5 points generate an error if file does not exist, or if its not open.
5 points every function has full specifications.
10 points templates are used to accommodate different test type.
5 points a flowchart for the second function, only the second function, is included and is correct.
5 points a structures, hierarchical chart is submitted and is correct.
10 points a do / while loop, is included, reads the data until the trailing value 0 for ID is encountered.
5 points a counter is used to count the number of elements read.
10 points proper passing by value/by reference
5 points a for loop is used to scan the data from the file the second time around.
5 points the output was sent to a file.
5 points the average of the class was printed.
10 points a function to print the message is called and message is printed and is correct.
15 points the program runs correctly and produces the intended results.
Lab-1 Grading Criteria: 5 points 5 points 5 points 10 points 5 points 5 points 10 points 5 points 10 points 5 points 5 points 5 points 10 points 15 points there are suffucient comments at the start of the program. generate an error if file does not exist, or if its' not open. Objective: The purpose of this project is to expose you to: every function has full specifications. templates are used to accommodate different test type. a flowchart for the second function, only the second function, is included and is correct. Loops, input/output, summation, maintenance and file processing Problem Specification: a structures, hierarchical chart is submitted and is coTTect. attached file data.txt, contains a class data that consists of an id numbers and a test scores for each of the students in a class. We don't know the number of students in the class and must use 0 a do/while loop, is included, reads the data until the trailing value 0 for ID is encountered a counter is used to count the number of elements read. proper passing by value/by reference as sentinel. 1. Write a function that reads the data from the file until 0 is encountered for the id number, counts the number of students and finds the average of the test not including 0. At this point you must a for loop is used to scan the data from the file the second time around. the output was sent to a file. the average of the class was printed. a function to print the message is called and message is printed and is correct. close the file. 2. Write a second function that prints the average calculated in the previous function, opens the same file again, reads the id and score for each of the students in the file using the counter from the previous function. Further this function wc another function that will write to a file, the id number, the score, and a message stating whether the score is below the class the program runs correctly and produces the intended results. Submission Details: average, is equal to the class average or above the class average. Requirements: Submit a print-out of The source, Input, output files . A flowchart. Hierarchical chart. o The id is an integer whereas the score may be an integer, a float or a double. o The first function above uses a while or a do loop o The second function uses a for loop o Every function has detailed specifications o The funetion main O does not do any processing, it's used as a driver funetion for the program o Output is sent to a file. Sample output: CIS Department Fall 2018 CIS 160 Test Analysis The elan average in this test i . 70.00 Student 1234 2134 3124 Test Scor Message 82.67 76.00 46.33 above Average is Equal to average below average End of class analysis
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
