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

CPSC 231: Assignment 4 (Worth 3%)

Grading Scales

Grade out of 24 Letter
24 A
22 - 23 A-
20 - 21 B+
18 - 19 B
16 - 17 B-
14 - 15 C+
12 - 13 C
9 - 11 C-
7 - 8 D+
6 D
5 D-
Below 5 marks F

 

New concepts to be applied for this assignment

 

Determining your Chinese astrological sign1

Although there is a great deal of complexity in the Chinese system of astrology, for the purpose of this assignment you simply need to be aware that each year is mapped to one of twelve Zodiac Animals.  The full version of the program will prompt the user for their year of birth (which can be within the range from 1900 - 2007) and it will indicate the Zodiac Animal for that year.  Then the program will prompt the person if they wish to determine the Zodiac Animal for another year.   Mappings of Zodiac Animals to the different years:

Year Animal  
1984 Rat  
1985 Ox  
1986 Tiger  
1987 Rabbit  
1988 Dragon  
1989 Snake  
1990 Horse  
1991 Ram/Sheep  
1992 Monkey  
1993 Rooster  
1994 Dog  
1995 Pig  
1996 Rat  
   : (Cycle repeats)  

In case you to see the mapping of Zodiac Animals for all the years 1900 - 2007 see the following link.

 

Grading

Basic assignment (worth 12 marks)

Your program works for a single 12 year cycle out of the nine cycles from 1900 - 2007.  For example, your program could determine the Zodiac animals for people born between 1900 - 1911 or (say) from 1984 - 1995.  Given that the user enters a value within this range your program will display onscreen this person's Zodiac Animal (it's up to you if you want to add the extra descriptions shown in the sample executable).

Extra features:

Once you complete all the features of the basic assignment you can complete these extra features for additional credit (make sure you backup your work first!)  Unless otherwise stated you can complete these extra features in whatever order or combination that you desire.

  1. Checks that the year entered by the user is not less than the lower bound (1900) nor should the value be less than smallest value within the range that your program can handle (for programs that only handle a single 12 year cycle).   If a value below this range is entered then your program will use the default lowest year that your it can handle.  For example if your program only calculates zodiac animals from 1996 - 2007 and the user enters 1979 as their birth year then the program will set the birth year to the default which in this case is 1996.  (Worth 2 marks)
  2. Checks that the year entered by the user is not greater than the upper bound (2007) nor should the value be greater than largest value within the range that your program can handle (for programs that only handle a single 12 year cycle).   If a value above this range is entered then your program will use the default highest year that your program can handle.  For example if your program only calculates zodiac animals from 1900 - 1911 and the user enters 2007 as their birth year then the program will set the birth year to the default which in this case is 1911.  (Worth 2 marks)
  3. The program will determine your Zodiac animal for any year between 1900 - 2007.  You should not do this by using a series of compound decision making constructs (i.e., if (expression) AND (expression)) or a series of cases because ideally you want your program to work for any arbitrary year.  (JT's hint: this means that you have figure out the formula that will determine the user's Zodiac Animal for a given year of birth). (Worth: 6 marks if a generic formula is employed, 2 marks if a series of compound if's or a case is employed).
  4. The program automatically re-runs itself with a loop:  After the program determines the user's Zodiac animal it will prompt the user if he or she wants to find the Zodiac animal for another year.  (Worth 2 marks)

 

Submission requirements

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

  1. Include a README file in your submission:  For this assignment your README file must include your contact information: your name, university identification number and UNIX login name so that your marker knows whose assignment that he or she is marking.   For this assignment you should also list the features that you implemented.

  2. Assignments (source code/'dot-p' file and the README file) must be electronically submitted.  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.  Unless you are told otherwise you are to email your source code and readme file to your TA and to me.  Make sure that include the following information in the subject line: "CPSC 231 Assignment X" where 'X' stands for the assignment number that you are submitting e.g., "CPSC 231 Assignment 3".

  3. As a reminder, you are not allowed to work in groups for this class.   Copying the work of another student will be regarded as academic misconduct (cheating).  For additional details about what is and is not okay for this class please refer to the following link.

To help make sure that you haven't missed anything here is a checklist of items to be used in marking.  A sample executable 'zodiac' can be found in UNIX under the directory: /home/231/tamj/assignments/assignment4.

1 This program is meant for educational (and perhaps entertainment) purposes only and is not meant to be a Scientific tool for actually predicting your personality characteristics.