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

CPSC 231: Assignment 4 (Worth 3%)

 

New Concepts to be applied for the assignment

  1. Program documentation
  2. Formulas
  3. Decision making constructs
  4. Loops

 

Determining your fundex rating

Ever wonder how fun a person you are, here's your chance to find out by determining how you rate on the fun index scale the "fundex".1

Your program will ask the user three questions.  For each question a numerical 'modifier' will be tabulated that is used in the overall fundex rating.

1) The person's age

2) The person's house or apartment number.

3)  The person's pet

1) Age

This value must be a positive integer between 1 and 113 (inclusive).  The age modifier will be the remainder of dividing the person's age by 100.

2) Address

The person enters in a positive integer between 1 and 9999 (inclusive).  The  address modifier will be equal to the remainder of dividing the address by 100.

3) Type of pet

Finally the person must indicate what type of pet that he or she owns, the values for the pet modifier are shown in the table below.

Pet

Pet modifier
No pet 2
Fish 5
Dog 6
Cat 7
Reptile 8
Other 9
Multiple pets 10

The fundex generator will perform a calculation that is based on the answers to these three questions:

    Fundex = (age modifier + address modifier) * pet modifier

The program will then display the numerical fundex value as well as providing a text description of what the numbers mean:

Fundex value Description  
000 - 499 What a bore!
500 - 999 A genuinely fun person.
1000 - 1499 A real wit.
Over 1500 A party animal!

Grading

Assignments that receive a 'C'

These assignments implement all of the required functionality listed above.  Assignment submissions must follow also follow good coding style and be fully documented.  

 

Assignments that receive a 'B'

These assignments fulfill all of the requirements for a 'C' level submission and performs some rudimentary error checking.  If an invalid value is entered the program will generate an appropriate error message and a default value will be used by the program.

  1. Age must be an integer value between 1 and 113 years (inclusive).  If a value is given outside of this range then the program will set the age modifier to 27.
  2. The person's house address or apartment number can only be a value from  1 - 9999 (inclusive).  If a value is given outside of this range then the program will set the address modifier to 4944.
  3. The answer for the type of pet must fall into one of the following categories:

    If the person does not provide one of the above answers then the program will automatically set the as a default value "no pet" so that the pet modifier will be set to 2.

Missing one of the above cases will reduce your maximum letter grade to a 'B-'.  Missing two cases will reduce your maximum letter grade to a 'C+'.  It is however not expected that your program can determine if the type of data that was entered is correct  e.g., at this point it's acceptable if your program crashes if the person enters a character instead of an integer.  While some of the better commercial programs do deal with issues like this, at this point it would be far too difficult to require you to implement a solution for this problem.     

 

Assignments that receive an 'A'

These assignments fulfill all of the requirements for 'B' level submission but it automatically re-runs itself.  Each time that a calculation has been performed the program will prompt the user if he or she wishes to run the program again or if they want to exit the program.

 

Other submission requirements

In addition to having fulfill the generic assignment requirements the requirements specific to this assignment include:

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 (e.g., 'A' to 'A-' for poor programming style such as employing poor naming conventions for identifiers, insufficient documentation or the use of global variables).

2. Include a README file in your submission:  For this assignment your README file must indicate what grade level has been completed (A, B or C).  This will allow your marker to quickly determine what he or she must look for and speed up the marking process.

3. Assignments (source code/'dot-p' file 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 (located on the second floor of the Math Sciences building) for the tutorial that you are registered in.  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.

 

Sample Executable

You can run a sample executable called "fundex" which can be found in Unix in the directory: /home/231/assignments/assignment4

1 Note: The fundex is to be used for entertainment purposes only and neither I nor the University of Calgary provides any express or implicit guarantees that the numbers generated will actually predict your success at social interactions.