Introduction to Computer Science I by James Tam Return to the course web page

CPSC 231: Assignment 5 (Worth 4%)

 

New Concepts to be applied for the assignment

  1. Problem decomposition through the use of functions and procedures
  2. One dimensional arrays

Writing a grade management program

For this assignment you are to write a program that allows a course instructor to track and manage a list of grades for a small class.  The full version the program will allow the user to: enter a set of grades for the class, display the class list, and to see some statistics about the performance of the class as a whole.

Grading:  Working assignments

Features of assignments that receive a 'C'

The program will allow the user to enter in the letter grades for a class with a maximum size of 25 students in a one-dimensional character array.  You can assume that the grades must be entered in upper case (your program doesn't have to handle lower case input).  For simplicity you can assume however that only the following letter grades exist: 'A', 'B', 'C', 'D', 'F' or 'W' (no plus or minus letter grades).  The user can enter fewer than 25 grades by entering 'Q' or 'q' when prompted to enter a grade.  The program should check that the grades are only one of these six valid values and it should provide a suitable error message if it is not and continue prompting the user for the next grade until either a valid value is entered or the user has finished the entry of grades.  To help prevent data entry errors, the program should indicate which student's grade is currently being entered as well as the max class size e.g., Student #12, Max Students = 25.

After the grades have been entered they will then be displayed onscreen in the following format: <Student number (1-25)> : <letter grade> <grade point>1.  Note: If the class size is less than 25 (i.e., the class isn't full) then the program should only display the occupied elements.  In a similar fashion, if the class is empty (i.e., it has no students in it) then the program will indicate that the class is empty rather than displaying an empty list. 

Modules to be implemented:

  1. Initialize: Set the array elements to default starting values.  (This module can also be used to clear all the elements too).
  2. Display: Shows the occupied array elements onscreen.
  3. Enter grades:  Steps through the array and allow the user to enter the grades.

Missing the features listed above:  You have the potential to receive a maximum grade of 'C' if you implement all of the above features.  If features are missed or improperly implemented then your mark may be reduced further (down to a minimum grade of a 'D').  Also keep in mind that your submission must not violate any coding style requirements.

  1. Input is not properly handled (e.g., program does not check that the grade is a valid letter A, B, C, D, F, W): -1 letter step for any violation (and not each instance)
  2. Awkward user interface (e.g., the user can't enter fewer than 25 grades, the program doesn't indicate which student's grade is currently being entered, error messages are impolite or unhelpful): -1 letter step for any violation (and not each instance)
  3. Program does not prevent the maximum class size from being exceeded (i.e., the user can try to input more than 25 grades): -1 letter step
  4. The grades aren't properly displayed (e.g., grades aren't shown in the required format, empty elements are displayed, program doesn't properly handle empty classes):  -1 letter step for any violation (and not each instance)

It is okay if you wish to write additional functions or procedures besides the three listed above, in fact you will find it essential.  How you wish to structure the remainder of your program is up to you, just make sure that your solution is guided by good design principles e.g., avoid putting all the code into a single function or procedure (especially the main procedure), each function or procedure should have a well defined task that gives it a purpose, if possible try to limit the length of a module so that it doesn't span more than one screen.

Additional capabilities

Implementing each of the additional features below can result in a grade increase up to a  maximum grade increase of six steps to yield an 'A' grade.

  1. Compute the average grade (worth 2 letter steps): Implement a function or procedure that will determine the average grade for the students who have completed the class.  (JT's Hint: The program should not be trying to compute the average of the character values that the user typed in, which are ASCII values, but the corresponding grade point1 - some sort of conversion must be done by your program first).  Students who have withdrawn from the class (letter value of 'W' or 'w') should not be counted in the class average.  For example if grades for the class were: A, B, W, F, then the average GPA = 2.33 = (4 + 3 + 0)/ 3.   The average grade will be shown after the grades for the whole class have been displayed onscreen. The output should appear in a neat and presentable fashion with 2 decimal places of precision displayed for the average.

  2. Find the mode (worth 2 letter steps): Your program will find the most frequently occurring grade (counting students that have withdrawn from the class).  The mode will be shown after the grades for the whole class have been displayed onscreen.  If there is an equal number of grades that were actually received by students then the program should indicate that the grades were distributed evenly.  For example if the grades in the class were: A, B, A, B there were only two letter grades that were assigned 'A's' and 'B's' so the program would indicate that the grades were distributed equally.

  3. Finding and displaying the lowest grade awarded (worth 1 letter step): Before displaying the grades the program will compare all the grades that were entered and display the lowest letter grade that was actually awarded to a student (excluding students who have withdrawn from the class).  For example, if the grades in the class were: A, B, A, B, C, A, B then the lowest letter grade would be a 'C'.

  4. Finding and displaying the highest grade awarded (worth 1 letter step): Before displaying the grades the program will compare all the grades that were entered and display the highest letter grade that was actually awarded to a student (excluding students who have withdrawn from the class).  For example, if the grades in the class were: A, B, A, B, C, A, B then the highest letter grade would be an 'A'.

Grading: Non-working assignments:

D submissions:

The student has invested considerable time and effort into the assignment, the program does not fulfill any of the above requirements but it does compile.

D- submissions:

The student has invested considerable time and effort into the assignment, the program does not fulfill any of the above requirements and it does not compile.

 

Other submission requirements

  1. Good coding style and documentation:  They will play a role in determining your final grade for this assignment.  Your grade can be reduced by a letter step or more if your submission was implemented using bad style conventions (e.g., "A" to "A-" for employing poor naming conventions for identifiers, insufficient documentation, the use of global variables or non-modular design).  See the coding style guide for additional details.

  2. Include a README file in your submission:  For this assignment your README file must indicate what grade level has been completed (e.g., A, B or C) as well as the specific features that are working e.g., "I completed all the requirements of the base level assignment plus the ability to find the mode as well as finding the lowest and highest letter grades so this assignment may receive a maximum grade of 'B-' for functionality."  This will allow your marker to quickly determine what he or she must look for and speed up the marking process.  Also you should list your contact information: name, university identification number so that your marker knows whose assignment that he or she is marking.  Finally be sure to list your Unix login name because submit will create a Unix directory that is the same as your login name and your marker needs to know which directory is yours.  Omitting this file will result in the loss of a letter 'step'.

  3. Assignments (source code 'files that end in dot-p' and the README file) must be electronically submitted via submit.  In addition a paper print out of the source code and README must be handed into the assignment drop box for the tutorial that you are registered in (located on the second floor of the Math Sciences building).  Electronically submitting the assignment allows your marker to run the code in order to quickly determine what features were implemented.  Providing a paper printout makes it easier for your marker to read and flip through your source code.  Missing the electronic submission will mean that your maximum grade attainable is 'D' or 'D-' (it is very time consuming to mark assignments when you only hand in paper submissions).  Missing the paper printout will result in the loss of a letter 'step'.

Sample Executable

You can run a sample executable called 'grades' which can be found in the Unix directory: /home/231/assignments/assignment5

1 Letter to grade point mappings: A = 4, B = 3, C = 2, D = 1, F = 0, W = NA (because classes that you withdraw from aren't counted in your overall grade point average).