Lecture notes for the Introduction to Computer Science for non-majors by James Tam | Return to the course web page |
Unless otherwise indicated the features of your program for this assignment are the same as for the previous assignment.
Function name |
Inputs / parameters |
Return value (s) |
Description of what the function does |
Marks |
main |
None |
None |
The starting point of execution for the program. |
NA |
introduction |
None |
None |
Describe how the program works. The function runs once as the program first runs. |
1 |
conclusion |
None |
None |
Display a signoff message so that the user knows that the program has ended. |
1 |
askAge |
age |
age |
Prompts the user to enter their age. (1 mark) Reads in the value entered by the user. (1 mark) Determines if the age is outside the allowable range (4 marks) and if so it sets the age to the default value. (1 mark) |
7 |
determineAgeModifier |
age |
Value for the age modifier |
Based on the age entered this function will calculate and return the age modifier. |
2 |
askGender |
gender |
gender |
Prompts the user to enter their gender. (1 mark) Reads in the value entered by the user. (1 mark) Determines if the gender is valid (2 marks) and if not it sets the gender to the default value. (1 mark) |
5 |
determineGenderModifier |
gender |
Value for the gender modifier |
Based on the gender entered this function will calculate and return the gender modifier. |
2 |
askComputer |
computer |
computer |
Prompts the user to enter their computer type. (1 mark) Reads in the value entered by the user. (1 mark) Determines if the computer type is not one of the allowable values (4 marks) and if so it sets the computer to a default value. (1 mark) |
7 |
determineComputerModifier |
computer |
Value for the computer modifier |
Based on the computer type entered this function will determine the value for the computer modifier and return this value back to its caller. |
2 |
generateLuckySum | ageModifer, genderModifier, computerModifier |
Value for the lucky sum | This function will return the sum of the three parameters. | 2 |
generateLuckyNumber | luckySum | Value for the lucky number | Based on the calculated lucky sum this function will determine the user's lucky number and return this value back to the caller. | 2 |
In addition to having fulfill the generic assignment requirements, the requirements specific to this assignment include: |
||
|
||
X = The appropriate assignment number (e.g., for Assignment 3 the subject would be titled "CPSC 217 Assignment 3") |
||
|
||
|
||
|
||
|
||
|
||
To help make sure that you haven't missed anything here is a checklist of items to be used in marking. | ||