The total cost of booking cinema tickets is calculated by multiplying the number of tickets by the ticket price of £14.50, and then adding a flat booking fee of £3.50.
A program is written to allow a user to enter the number of tickets as a whole number between 1 and 8, then calculate and output the total cost.
01 num = 0
02 total = 0.0
03 num = input("Enter number of tickets")
04 if num < 1 OR num > 8 then
05 print("Error: invalid selection")
06 else
07 total = (num * 14.50) + 3.50
08 print(total)
09 endif
Explain, using examples from the program, two ways to improve the maintainability of the program.
95 exam-style questions on OCR GCSE Computer Science Programming fundamentals. Each one has a worked solution and a mark scheme showing where the marks go.