A developer is developing a program for a client - AQA - GCSE Computer Science - Question 12 - 2021 - Paper 1
Question 12
A developer is developing a program for a client. The developer is given the following instructions.
"Many of my friends ask me to walk their dogs for them. All of ... show full transcript
Worked Solution & Example Answer:A developer is developing a program for a client - AQA - GCSE Computer Science - Question 12 - 2021 - Paper 1
Step 1
Boolean/bool;
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
In programming, a boolean (or bool) is a data type that can hold one of two possible values: true or false. In this context, it could be used to determine if a dog walker has more than one dog, influencing the charges.
Step 2
I. Case
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
A case construct can be implemented to handle different scenarios based on the input received, for example: handling the charging mechanism based on the duration of the walk. For instance:
if num_of_dogs > 1:
# Do not charge extra
else:
# Charge accordingly
This logical structure helps in applying the correct rules for charging based on the number of dogs walked.