Write a program to keep records and find averages, minimums, and maximums for a class of students. Assume that the class can have any number of students from 0 up to 40. Data kept for each student is made of an integer student identifier and two integers representing scores for two tests. There will be two sources of input namely a file and the keyboard. The program is to output a table of three columns for student number, test 1 score, and test 2 score. At the bottom, the program will display the highest score, minimum score, and average for each test. Here is an example of how the final output may look:
STUDENT TEST 1 TEST 2
------------- -------- --------
1234 78 91
2134 67 86
3124 93 71
High score 93 91
Low score 67 71
Average 79.3 82.7
REQUIRED PROGRAMMING FEATURES
Your program should declare either three integer arrays of size 40 or one two-dimensional 3X40 array. There should be a separate variable that counts how many student records are in the arrays.
Your program should have five functions as follows:
The array(s) and the records count will be declared in this function. Six additional variables should be declared here to store averages, minimum scores, and maximum scores for each test. There will be statements to call the other four functions from here passing the arrays that are needed by the called functions. The statement that calls the readStudentFile and inputStudentRecords functions will be in an assignment statement that assigns the function call to the records count variable.
This function will be called from main and will have the student records array(s) as its parameter(s). It should declare a variable to keep track of the number of records that have been input which will be initialized to 0. It should also declare a file input variable. It should then enter a loop that reads identifier, test 1 score, test 2 score in that order into the array(s) indexed by the record count until end of file. Record count should be increased by one after each loop. After the loop, record count should be returned.
This function will be called from main and will have the student records array(s) and the record count as its parameter(s). Do not initialize the record count in this function.
Student records will be entered in a loop that runs until the person inputting responds that there are no more student records to input. The input should go into the array(s) indexed by the records counting variable which should be increased by 1 after each record is input. Arrangement of statements for the loop may look as follows:
response = ‘y’; // Initializing loop control variable
while (response == ‘y’)
cout << “Do you have a student record to input: “;
cin >> response;
if (response == ‘y’)
cout << “Enter identifier, test 1 score, and test 2 score for the student: “;
// statement to input into array(s) and increase record count come here
The record count should be returned. (Make sure that indexing starts after the last record from read from the file).
Parameters to this function will be the two tests arrays (if using three one-dimensional arrays) or the whole student records array (if using a two-dimensional array), the count of student records, and six reference parameters being two averages, two minimum scores, and two maximum scores for each test.
This function should have a loop that goes up to the record count and maintains two totals one for each test, two minimums one for each test, and two maximums, one for each test. After the loop, each of the two totals should be divided by the count of records to come up with an average for each test.
Parameters to this function will be array(s), the count of student records, the two averages, the two minimum scores, and the two maximum scores.
This function should first output column headings and then enter a loop that goes up to the record count and outputs the contents of the array(s). After exiting the loop, the program should display the highest scores on one line, then the lowest scores on another line, and finally the average score on a third line. Use functions in iomanip to format output.
PROGRAM STYLE REQUIREMENTS
Your program should start with several comment lines that state your name and the purpose of the program as well as the date the program was written.
All statements inside each function should be indented right. If a function has a loop or if or switch, statements inside the loop or if or switch should be indented right (see the code snippet given in 2).
There should be a comment just before each function to state the purpose of the function and what parameters it takes as well as what it returns. Furthermore, there should be a comment to the right of each variable declaration (no comment inside parameter list) to briefly state what the variable will store. There should a comment before every loop to state what the loop is doing.
EXTERNAL DOCUMENTATION REQUIREMENTS
Your will write a design document in Microsoft Word (or other word processing software) that has the following format:
1. PROBLEM DEFINITION
The problem definition comes here. This includes verbatim words from the PROBLEM section below.
Which libraries will be included and explain the reason for the library. For example, you will state that “The iostream library will be included because the program displays messages and receives keyboard input and functions for input/output are found in the iostream library.”
Give the variables that you have identified to hold output data and explain the type of data for each variable. Similarly, give variables to hold input data and describe them. If any calculations will be performed, give variables to store results of formulas. Also give variables to hold constants.
Give formulas to convert input data to output data
Give drawings of input and output screens (no screen images).
Give step by step statements to carry out the required programming task in English phrases (pseudocode) making sure to indent code that belongs to a block.
What was the platform and programming environment used (This will be Linux on district.bluegrass.kctcs.edu)? Name the compiler (This will be g++). How did you test your program? Give the data used to test the program. Did you encounter any unusual situations when running the program? (Scripts of program run come here)
I will provide an example external documentation in a separate document.
PROGRAM SUBMISSION REQUIREMENT
a) Upload to Blackboard a copy of your external documentation. This may be in Word, PDF, RTF, OpenOffice format.
b) Upload to Blackboard a copy of your source (.cpp) file of your program as FileZilla'd (not MS Word or PDF or RTF or WPS formats).
It is expected that you will use the following process:
1. Read the description of the PROBLEM statement above carefully
2. Think about it and write sections 1-3 of external documentation and save in a Word document on your desktop (or My Documents)
3. Login to district.bluegrass.kctcs.edu and then use pico to type the program converting to C++ your design from and add improvements for readability and user friendliness and save it with a .cpp extension.
4. While still logged into district.bluegrass.kctcs.edu, compile and run the program saving run session (what appears on screen) to typescript
5. Logout of district
6. Run FileZilla to transfer to your desktop (or My Documents) the program from step 3 above and the typescript that you saved in step 4 above
7. Complete section 4 of your external documentation that you did in 2 above and use the typescript results from 4 above as your test data to be reported
8. Log into Blackboard and go to the Assignments page then click on the Programming Challenge title. Click Browse My Computer and attach the program that you transferred in 6 above and click Open. Click Browse My Computer again and attach the external documentation that you completed in 7 above