Assignment: TMA 02
1|Page
, Question 1:
a) When the [space]key_pressed is clicked, it will delete the existing
pupils name from the sensing variable and the user is asked to input
the students name, in this case “Dani” is entered. Next the user is
asked to input “what distance in km was run” and 20km is entered.
The “distance percentage” score is then worked out and provides a
percentage out of 100. Dani has scored 80% and was added to the
“gold_medel_list” as the program, using the variable entered,
determined that “distance_percentage > 60 then add name to
gold_medel_list”.
Figure 1.1
b) i) A numerical value in this program that is appropriate to refer to as a
constant is 60 in the “distant_percentage” variable as it is fixed and
cannot be change for the purpose of adding candidate to the
“gold_medal_list”.
b)ii) an appropriate name for the constant can be
MAXIMUM_DISTANCE.
2|Page