A parking validation system at a shopping centre uses an algorithm to determine discounted parking fees based on total spending and hours parked.
Using Figure 3, complete the table.
Figure 3
spendAmount ← USERINPUT
hoursParked ← USERINPUT
parkingFee ← 0.0
msgStandard ← "No discount applied"
msgExceeded ← "Standard rate applies"
IF hoursParked ≤ 4 AND spendAmount > 0.0 THEN
IF spendAmount > 60.0 THEN
parkingFee ← 1.0
OUTPUT parkingFee
ELSE IF spendAmount > 30.0 THEN
parkingFee ← (hoursParked * 2) - 1.5
OUTPUT parkingFee
ELSE
OUTPUT msgStandard
ENDIF
ELSE
OUTPUT msgExceeded
ENDIF
| Input value of spendAmount | Input value of hoursParked | Output |
|---|---|---|
| 65.0 | 2 | |
| 45.0 | 3 |
208 exam-style questions on AQA GCSE Computer Science Representing algorithms. Each one has a worked solution and a mark scheme showing where the marks go.