CPSC 120 Assignment 7 | Back to Assignment index page |
Instructor: Brenneman | |
Due Date: midnight, Wed, Dec 5 |
Characters, Strings, Arrays, Records, Sorting
Description: The results of a true-false exam have been entered into a file. Each student's information consists of answers to ten true-false questions and their last name. The correct answer string is the first line of the file, before the student answers. There will be exactly 2 blanks between the student's answers and the beginning of their last name on each line of the file. There may be as few as 5 students and as many as 25 students in the file (You'll need to check for end of file). The last name can be up to 20 characters long, and will NOT be padded with blanks, so you should use Get_Line to read the names in. A sample data file follows:
TFTTFFTTTF
TFTFFFTTTF Smith
FTFTFTTTFF Jones
TFTFTTTTTT Wilkins
TTFFTFFTTT Quisenberry
TTFTTTFFTF Caudill
TTTTTTTTTT Brenneman
FTFFTFFTFT Rotenberry
TFTFFFTFTF Okie
TTTFFTTFTF Chase
FFFFFFFFFF Dodson
TFTTFTTFTF Davis
FTFFTTFFFT Dalton
FTFTFTFTFT Anderson
TFTFTTFTFT Clark
Develop and test a program that reads the correct answer string and each student's
answers. Next the program computes the number of correct responses for each
student. The program then sorts the names and scores highest to lowest. It will
display the number correct and name for each student. It will also display the
average number of correct responses for the class. Sample output follows:
Name | Number Correct | |
Smith | 9 | |
Davis | 8 | |
Okie | 7 |
etc.
Class Average = 4.5
You should get your input from a file using Unix redirection. Sample data used for evaluation will be different than the file above.
The program must be in a file named program7.adb, don't forget to use the .adb extension for your filename. Use the submit command to turn in your program for grading. Remember to remote shell to rucs2 before executing the submit command, (rsh rucs2). Also, make sure that your current working directory is the one that contains your program7.adb. Example, submit cpsc120-05 program2.adb (remember to use the correct section number for your class). Please compile and run your program immediately before submitting it. Never make a change to the code file(s) and turn it in without compiling and running it first. It is very easy to make a last minute mistake that introduces syntax errors, so checking before submitting can save you an unnecessary grade of 0. You may submit as many times as you like, but only the last submission is kept. Since only the last submission is kept, if the last one is late, then your assignment is late and will receive an automatic grade of zero (0).