ITEC 320: Programming Assignment 3
Due Date for Dr. Okie's Section: 11:59:59 p.m. on
Monday October 24, 2011
Submit command for Dr. Okie's section: submit
itec320-02 grades.adb
Last modified:
Updates:
- Removed (non-visible) spaces from ends of some lines in sample
input file.
Write a program that reads student scores from standard input
and outputs certain specified information based on those scores.
The input file will begin with four lines that give the number and weight
for four types of grades: programs, quizzes, tests, and final exam,
respectively.
After these four lines will come five lines of data for each student:
- Name (will be fewer than 70 characters)
- Program scores (missing program scores will receive a grade of 0)
- Quiz scores (missing quiz scores will receive a grade of 0)
- Test scores (missing test scores will be replaced with the final
exam score)
- Final exam score
In the following example input file,
there are two programs and the weight of programs is
40%, 4 quizzes are worth a total of 10%, 2 tests are worth a total of 30%,
and the single final exam is worth 20%.
Sample Input File (to be read from standard input):
2 40
4 10
2 30
1 20
Bob
40 40
40 40 40 40
40 40
40
Adam
100 100
90 90 90 90
80 80
70
Bill
50 50
50 50 50 50
50 50
50
Jill
100 50
30 40 50
50
90
Expected Output for Sample Input File:
Name: Adam
Overall Average: 87.0
Letter Grade: B
Category Weight Average Points
Programs 40.0 100.0 40.0
Quizzes 10.0 90.0 9.0
Tests 30.0 80.0 24.0
Final Exam 20.0 70.0 14.0
Name: Jill
Overall Average: 72.0
Letter Grade: C
Category Weight Average Points
Programs 40.0 75.0 30.0
Quizzes 10.0 30.0 3.0
Tests 30.0 70.0 21.0
Final Exam 20.0 90.0 18.0
Name: Bob
Overall Average: 40.0
Letter Grade: F
Category Weight Average Points
Programs 40.0 40.0 16.0
Quizzes 10.0 40.0 4.0
Tests 30.0 40.0 12.0
Final Exam 20.0 40.0 8.0
Name: Bill
Overall Average: 50.0
Letter Grade: F
Category Weight Average Points
Programs 40.0 50.0 20.0
Quizzes 10.0 50.0 5.0
Tests 30.0 50.0 15.0
Final Exam 20.0 50.0 10.0
Other points on data:
- All data will be reasonable (ie will fit in 32 bit variables).
- Assume that the weights sum to 100.
- Assume that the number of items in each category is positive.
- The number of Final Exams will always be 1 and the Final Exam
score will never be missing.
- All scores are based on a maximum of 100 points.
- All scores in a given category are equally weighted.
Other points on input:
- Input is to come from standard input.
- All input values will be integers.
- All data for a given category will be on a single line.
- Lines of input will NOT begin with white space.
- There will be no trailing blanks on an input line.
- There will be at least one space between any pair of values on a line of input.
- There will be between 1 and 100 students.
- Since you don't know how many grades will be on a line, you can use
look_ahead
or End_Of_Line to help you determine if there are any more values on the line.
Other points on output:
- Your program is to have no prompts.
- Students are to be output in descending order of letter grade and
in the same order as they were input within a given letter grade
(ie use a stable sort).
- Output all numeric values with one place to the right of the decimal point.
- Use a 10 point scale: 90.0 and above is a grade of "A", less than 60 is a grade of "F", and so on.
Other points:
- Your program should be called
grades.adb
- You must write a routine that actually sorts the array (in other
words, you can't just go through the array and print all the A's, then
go though it again to print all the B's, etc., which would produce the
correct output without really sorting the data).
Remember that your sort needs to be stable.
- Your main routine is to have only three statements
(ie it will consist of three procedure calls: input, calculate, output).
- Each procedure is to have exactly one parameter.
- You should make good use procedures, functions, records, and enumerated
types when designing your program.
- Make sure that you test your program on rucs2.
- Make sure that you do NOT use any GLOBAL VARIABLES in your
program! All communication with procedures and functions must be via
parameters and return values!
Style:
In coming up with your Ada solution to the following problem, please follow
my style guide.
In particular, please note the use of consistent indentation, named constants,
and descriptive constant and variable names. Please remember that the first
thing in any program file should be a comment that gives a brief overview
of what the file contains (and should do). Also remember to keep
your lines less than 80 characters long. Not only does this mean that printouts
won't run off the side of the page, but it also makes your programs look neater
on an 80 column wide xterm window (a popular size).
If you are unsure of an element of programming style, please
ask, as I would be more than happy to show you what I want.
Submission:
Use the submit command to turn your
program in for grading. You may submit
as many times as you like, but only the last submission
is kept. In particular, be aware that since only the last submission is
kept, if the last one is late, then your assignment is late and will thus
receive a late penalty. Also remember that you must be on
rucs2 for submit to work. To submit your work for grading
do the following:
submit itec320-02 grades.adb
Dr. Okie's Home Page,