Computer Science 1621
Computer Science I

Programming Assignment 3
Arithmetic and Procedures (35 points)
Due Friday, October 16, 1998

Introduction

This assignment will involve reading data from the keyboard, performing arithmetic operations on it, and printing formatted results on the screen. Your program will be structured into procedures. Since your program will be heavily modularized, be sure to test each procedure individually as you progress.

The Problem

It is a harsh, harsh world out there today. But that has nothing to do with this assignment. In this assignment, you are in a better world, a happier world, a world where you get to vote on how your grade will be calculated, a world in which the chicken came before the egg and everybody knows it, and the spider didn't bite Peter Parker.

Here is the deal: your incredibly nice, no, make that impossibly nice 1621 instructor has offered to let your class vote on which of four plans will be used to determine your grade total. You and your two friends are all taking 1621 and you want to determine which grading scheme gives the three of you the highest average grade so that you can use all three of your votes to pick the same scheme. The four plans are the following:

Note that homework scores are out of a possible 60 points, program scores are out of a possible 195 points, and exam scores are out of 300 points. Also, you can assume that no one has more than 5 late days.

You will write a program that reads in the raw scores for each of three students and then will print out their grade using each of the four methods plus the average score for the three students for each of the four methods in a nice table. Your program should run like this:

This program calculates the average score for three students
based on four methods for combining their raw exam, homework
program scores and their number of late days used.  The
program will prompt you for these four values (in that order)
for each of the three students and then print their score
using each of the four schemes.

Raw scores for Student 1: 290 20  85 1
Raw scores for Student 2: 150 60 180 4
Raw scores for Student 3:  45 20 195 1

--------------------------------------------------------------------
| Student | Exm | HW | Prg | L | Meth 1 | Meth 2 | Meth 3 | Meth 4 |
--------------------------------------------------------------------
|       1 | 290 | 20 |  85 | 1 |  71.12 |  82.31 |  96.67 |  50.17 |
|       2 | 150 | 60 | 180 | 4 |  70.31 |  51.35 |  50.00 |  34.50 |
|       3 |  45 | 20 | 195 | 1 |  46.77 |  33.75 |  15.00 |  59.08 |
--------------------------------------------------------------------
| Average |                    |  62.73 |  55.80 |  53.89 |  47.92 |
--------------------------------------------------------------------

Program Structure

Your main function must consist of declarations and function calls only. Following is an outline of the main function you should use. Your job is to provide the declaration part of the program and also the parameters for those procedure calls which require them.

  int main () {
    float Meth1Avg, Meth2Avg, Meth3Avg, Meth4Avg;
    /* Other needed variables */

    Welcome();

    GetRawScores( ... );
    GetRawScores( ... );
    GetRawScores( ... );
 
    CalcScores( ... );
    CalcScores( ... );
    CalcScores( ... );
 
    Meth1Avg = CalcAverage( ... );
    Meth2Avg = CalcAverage( ... );
    Meth3Avg = CalcAverage( ... );
    Meth4Avg = CalcAverage( ... );

    PrintHeading();

    PrintLine( ... );
    PrintLine( ... );
    PrintLine( ... );
 
    PrintAverages( ... );
  }

Your TA will discuss with you how each of these routines should work. Note that you should also plan on implementing four functions that calculate the score for each method.

What To Hand In

Consult the Programming Assignment Guidelines for information on what to put in the report to go with this program. Note in your structure chart which boxes correspond to functions in your program. Make sure that your test output shows that your program produces output exactly like that given above. You should also include other samples of your program running (on different data values to demonstrate that it works).