Assignment 6 — interactive problem solving
Monday, September 5
Program dateable.py
-
Problem description
- For a single user-supplied age, tell them how old a person must be to have dating be acceptable according to the following folk rule:
- You should only date someone who is at least seven years older than than half your age.
- For example, an 18 year old needs to date somebody at least 16 year's old (i.e., 7 + ( 18 / 2 ) ).
-
Requirements
- The dateable age is to be calculated by using the above folk rule.
- Use separate variables for storing the user-supplied and dateable ages.
- The displayed dateable age is to be integer.
-
Three different possible program runs
Enter your age (integer): 19
19 year olds should date somebody who is at least 16 years old
Enter your age (integer): 22
22 year olds should date somebody who is at least 18 years old
Enter your age (integer): 88
88 year olds should date somebody who is at least 51 years old
-
Suggested algorithm
- Prompt user to supply an integer age
- Convert user reply to integer
- Compute minimum age according to dateability formula
- Print the result of the computation