Race Day [Exercise]
This exercise is about an annual race which has a lot of participants and each participant will be given instructions based on their registration.
There are adult runners above 18 years old and youth runners below 18 years of age.
Runners are assigned a race number and start time based on their age registration.
Race number:
Early adults recieve a race number at or 1000 above
All others recieve a race number below 1000
Start time:
Adult registrants run at 9:30 am or 11:00 am.
Early adults run at 9:30 am.
Late adults run at 11:00 am.
Youth registrants run at 12:30 pm (regardless of registration).
Solution:
Solution with switch
and case
statement:
Last updated