ITEC 320: Programming Assignment 3


Due Date - 11:59:59 p.m. of Tuesday 10/20/2009

Due Date - 11:59:59 p.m. of Monday 10/19/2009

Submit Command: submit itec320-01 grades.adb


Update 10/20/09:

  1. Corrected Jill's Average and Points for Tests, and her Overall Average.
  2. There will be between 1 and 100 students.

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:
  1. Name (will be fewer than 70 characters)
  2. Program scores (missing program scores will receive a grade of 0)
  3. Quiz scores (missing quiz scores will receive a grade of 0)
  4. Test scores (missing test scores will be replaced with the final exam score)
  5. Final exam score
In the example input file shown below, 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%:
 
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
The output based on this file should be as follows:
 
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: 73.5 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     75.0   22.5  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:
  1. Assume that the weights sum to 100.
  2. Assume that the number of items in each category is positive.
  3. The number of Final Exams will always be 1.
  4. There will be no more than 10 grades in any category.
  5. All scores are based on a maximum of 100 points.
  6. All scores in a given category are equally weighted.
Other points on input:
  1. All data for a given category will be on a single line.
  2. No input line will be long than 100 characters.
  3. Since you don't know how many grades will be on a line, you should use look_ahead to help you determine if there are any more values on the line. The program lookaheaddemo.adb (prettified) show look_ahead in use.
Other points on output:
  1. Your program is to have no prompts.
  2. 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).
  3. Output all numeric values with one decimal point.
  4. 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:
  1. Your program should be called grades.adb
  2. Your main routine is to have only three statements (ie it will consist of three procedure calls: input, calculate, output).
  3. You should make good use procedures, functions, records, and enumerated types when designing your program.
  4. Make sure that you test your program on rucs2.
  5. 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-01 grades.adb

Dr. Okie's Home Page,
Last modified on Thursday, 22-Oct-2009 16:26:39 EDT