Programming fundamentals
64
0/4

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.

[4]

Programming fundamentals Questions

Practise OCR GCSE Computer Science Programming fundamentals with exam-style questions for GCSE Computer Science. 100 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.

PreviousNext

Programming fundamentals Questions

  1. GCSE
  2. /Computer Science
  3. /Programming fundamentals