Description
Problem:
Your friend the biology lab assistant needs to calculate the average time it takes each of
his rats to run through a given maze. For three days he runs each rat through the
maze once, and records the amount of time it takes. Write a C++ program that will,
after the test runs are all complete, calculate the average time it took for each of his 3
rats to run the maze, and print a report to a file.
Input: The user should be prompted to input the name and 3 maze times for each of 3
rats. The name may have spaces in it. The three maze times will be positive integers.
Processing: Compute the average maze time for each of the rats by computing the
mean of their 3 maze times.
Output: The program should output a lab report to a file named “lab_report.txt”. The
first row of the report should be a list of column headers that label the data to be
output. This should be followed by a row for each rat that lists their name, each of the
three maze times, and the average. This should be followed by the word “Smart” if the
average is less than 30. If it is 30 or above, it should be followed by the word
“Normal”. The final average should be formatted to 1 decimal place. The numerical
data in each column should line up under its column header.
Name Time 1 Time 2 Time 3 Avg Rating
Black Fred 28 40 29 32.3 Normal
Lima Bean 28 31 25 28.0 Smart
Master Splinter 25 27 39 30.3 Normal
Additional Requirements:
• All of the output data should be LEFT justified for this assignment.
• The name should be displayed in a width of 20 characters, the numerical data
should be displayed in a width of 7 characters each.
• Note that the header columns may be output as one long string with spaces
embedded in the proper places.
• Use proper data types (only use float and double when necessary).
• Do NOT use loops.
• Grading Threshold: Your program must compile and run, and pass the
following minimal test case, otherwise you will receive a 0.
Note that the names of the rats have no spaces, the averages are whole numbers,
and the Rating is not required. Also the output may be displayed to the screen.
Style:
See the Style Guidelines document on the course website. The grader will deduct
points if your program violates the style guidelines.
Logistics:
Name your file assign3_xxxxx.cpp where xxxxx is your TX State NetID (your
txstate.edu email id). The file name should look something like this: assign3_js236.cpp
There are two steps to the turn-in process:
1. Submit an electronic copy using the Assignments tool on the TRACS website for
this class (tracs.txstate.edu). Submit the .cpp file, (NOT a .cbp file!).
Please enter the name of the first rat.
Fred
Please enter three maze times for the first rat.
40 35 30
Please enter the name of the second rat.
Bean
Please enter three maze times for the second rat.
28 30 29
Please enter the name of the third rat.
Splinter
Please enter three maze times for the third rat.
30 30 30
Name Time 1 Time 2 Time 3 Avg
Fred 40 35 30 35
Bean 28 30 29 29
Splinter 30 30 30 30
2. Submit a printout of the source file at the beginning of class on the day the
assignment is due. Please print your name on the front page, and staple if there
is more than one page.
See the assignment turn-in policy on the course website (cs.txstate.edu/~js236/cs1428)
for more details.

