Introduction to Computer Science I by James Tam | Return to the course web page |
1) The person's age |
2) The person's favourite primary color |
3) The person's gender |
4) The person's current level of education |
1) Age
This value must be a positive integer between 1 and 113 (inclusive). This value will stored as-is in an integer variable and is used to determine the modifier resulting from the person's age.
2) Favourite primary color
The person will be able to pick their favourite of the following three colors: red, blue or green
Color
Color modifier
Red 15 Blue 20 Green 10
3) Gender
The person must indicate if they are a male or female.
Gender
Gender modifier
Male 73 Female 79
4) Current level of education
For this question the program will ask the person to indicate the level of education that the person currently enrolled in or the highest level that has been completed (if the person is not currently a student).
Level of education
Education modifier
High school
12
Undergraduate post-secondary
16
Graduate: Masters program
18
Graduate: Doctoral program
21
An example calculation is shown below:
These assignments implement all of the required functionality listed above. Assignment submissions must follow also follow good coding style and must be fully documented.
These assignments fulfill all of the requirements for a "C" level submission and performs some rudimentary error checking:
If a character other than 'r', 'b' or 'g' is entered then the program will indicate that it will choose red as the favourite color to red and set the color modifier to 15.
If another value is given for the level of education then the program will indicate that it assumes that the person has an undergraduate level of education and the education modifier will be set to 16.
These assignments fulfill all of the requirements for "B" level submission and also the user doesn't have to rerun the program in order to generate another lucky number. 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.
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 and the README file) must be electronically submitted via submit. In addition a paper print out of the source code must be handed into the assignment drop box for the lab 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.
1 Note: The Lucky Generator program 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 provide you with greater financial profit or personal gain.