COSC 1435 Lab 12
This lab gives the student practice in working with file data, using arrays,
and calling functions.
Before class on April 29, 2013
Do the following:
1. This program opens
a disk file that contains student names and grades. Each student will have
12 grades. Do the following:
Open the disk
file and verify it opened properly (you may use the functions you developed
for earlier labs to accomplish this). Read in each line of the data file,
then process each line. The information on each line of the data is space
delimited (you can use the file handle and the input operator ('>>')
to read the data). Store the name in two strings and the grades in an array
of 12 integers. Here is the data file: lab12Data.txt
Print a report
that shows for each student the student's name (each student will have a
first and a last name), their average for the 12 grades, their high grade,
their low grade, and their median grade. This report should be in columns,
with appropriate column headers.
There must be
a separate function that determines the average grade, the high grade, the
low grades, and the median grade. Use the sortArray
function from program from Gaddis to sort your data for the median calculation
(remember to properly attribute the sort program). All of these functions
must be written to take in an array of integers of any size and to return
a value to the calling program, as was demonstrated in class.
After all the
students have been processed, write out a report that shows the class average
for each of the 12 grades. To do this you need to total all of the student
grades on assignment 1, then find the average for that assignment. Repeat
for each assignment.
This lab requires a lab report/documentation package. All of these items
are not typically in the same file (source code and sample output should
definitely be in their own files), but the main lab report file must
reference each item by file name. Here is a sample
lab report. The main lab report must either be a text file (with
a .txt extension) or a Microsoft Word file (with a .doc extension).
The lab report must includes the following or references (the file name
that was attached to the mail) to the following information:
output, with sample data.
was this program tested, including the test values you put into
the program to verify that it worked properly for all types of
cases within the program specifications.
problems/successes did you have with this program?
of how much time you spent working on this lab
Submission. You will be submitting this lab
via Blackboard. The teaching assistant will provide further instructions
on how to accomplish this. Prepare the following:
source code. This file should be called lab12***.cpp, where the ***
is replaced with your initials.
A copy of
your program output saved as a file. This file should be called lab12***.txt,
where the *** is replaced with your initials. The .txt signifies that
this is an ASCII text file.
A lab report
as described above. The lab report may be in a Microsoft Word document,
with a .doc suffix or an ASCII text file with a .txt suffix. Make sure
it contains all of the required items. This file should be called either
lab12***doc.txt for a text file or lab12***doc.doc for a Microsoft Word
file, where the *** is replaced with your initials.
Submit via blackboard following
the instructions given during the lab.
Criteria: 100 points available for this lab.