Skip to main content
A-LevelComputer ScienceFurther programming9618/41 · May/June 2023 · Q232 Marks

A computer game is being designed that will include different vehicles. A prototype for the game is being developed using object-oriented programming. The class Vehicle stores data about the vehicles. Each vehicle has an identification name, a maximum speed, a current speed and a horizontal position. The value IncreaseAmount is added to the current speed each time the vehicle increases its speed. Vehicle ID: STRING stores the identification name for the vehicle MaxSpeed : INTEGER stores the maximum speed CurrentSpeed : INTEGER stores the current speed IncreaseAmount : INTEGER stores the amount CurrentSpeed increases by HorizontalPosition : INTEGER stores the horizontal position Constructor() initialises ID, MaxSpeed and IncreaseAmount to the parameter values initialises both CurrentSpeed and HorizontalPosition to 0 GetCurrentSpeed() returns the current speed GetIncreaseAmount() returns the increase amount GetHorizontalPosition() returns the horizontal position GetMaxSpeed() returns the maximum speed SetCurrentSpeed() assigns the parameter to the current speed SetHorizontalPosition() assigns the parameter to the horizontal position IncreaseSpeed() calculates and stores the new speed and horizontal position of the vehicle

  1. (a)(i)Write program code to declare the class Vehicle. All attributes must be private. You only need to declare the class and its constructor. Do not declare any other methods. Use your programming language's appropriate constructor. If you are writing program code in Python, include attribute declarations using comments.[5]
  2. (a)(ii)Write program code for the get methods GetCurrentSpeed(), GetIncreaseAmount(),GetMaxSpeed() and GetHorizontalPosition()[3]
  3. (a)(iii)Write program code for the set methods SetCurrentSpeed() and SetHorizontalPosition()[3]
  4. (a)(iv)The method IncreaseSpeed(): • adds IncreaseAmount to the current speed • adds the updated current speed to the horizontal position. The current speed of a vehicle cannot exceed its maximum speed. Write program code for the method IncreaseSpeed()[3]
  5. (b)(i)The child class Helicopter inherits from the parent class Vehicle. A helicopter also has a vertical position and changes the vertical position when it increases speed. Helicopter VerticalPosition : INTEGER stores the vertical position VerticalChange : INTEGER stores the amount VerticalPosition changes by MaxHeight : INTEGER stores the maximum height the helicopter can reach Constructor() takes the ID, maximum speed, increase amount, vertical change and maximum height as parameters initialises the vertical position to 0 GetVerticalPosition() returns the vertical position IncreaseSpeed() changes the current speed, horizontal and vertical position of the helicopter Write program code to declare the class Helicopter. You only need to declare the class and its constructor. You do not need to declare the other methods. Use your programming language's appropriate constructor. All attributes must be private. If you are writing in Python, include attribute declarations using comments.[5]
  6. (b)(ii)The Helicopter method IncreaseSpeed() overrides the method from the parent class and: • adds the amount of vertical change to the vertical position • adds IncreaseAmount to the current speed • adds the updated current speed to the horizontal position. The vertical position of a helicopter cannot exceed its maximum height. The current speed of a helicopter cannot exceed its maximum speed. Write program code for the method IncreaseSpeed()[4]
  7. (c)A procedure needs to output the horizontal position and speed of a vehicle. If the vehicle is a helicopter, it also outputs the vertical position. All outputs must include appropriate messages. Write program code for this procedure.[3]
  8. (d)(i)The main program needs to: • instantiate a car as a new vehicle with the ID "Tiger", a maximum speed of 100 and an increase amount of 20 • instantiate a new helicopter with the ID "Lion", a maximum speed of 350, an increase amount of 40, a vertical change of 3 and a maximum height of 100 • call IncreaseSpeed() twice for the car and then call the output procedure from part 2(c) for the car • call IncreaseSpeed() twice for the helicopter and then call the output procedure from part 2(c) for the helicopter. Write program code for the main program.[5]
  9. (d)(ii)Test your program. Take a screenshot of the output.[1]

Mark scheme

Marking points from the official mark scheme (May/June 2023). The mark or mark type is shown in brackets.

  1. [5] 1 mark each • Class header (and close where appropriate) • 5 (private) attribute declarations including data types • Constructor header (and close where appropriate) taking 3 parameters (min) • Assigning ID, MaxSpeed and IncreaseAmount to parameters • Assigning CurrentSpeed and HorizontalPosition to 0
  2. [3] 1 mark each • 1 get function header (and end where appropriate) with no parameter ... • ...returning attribute (without overwriting) • 3 further correct get methods
  3. [3] 1 mark each • 1 set procedure (and end where appropriate) taking parameter ... • ...assigns parameter to the attribute (without overriding) • Second correct set method
  4. [3] 1 mark each • Method header (and close where appropriate) with no parameter and adding IncreaseAmount to CurrentSpeed • Checking if MaxSpeed is exceeded and limiting to max speed (remove increase or assign maximum) • Adding updated CurrentSpeed to HorizontalPosition in all cases (whether MaxSpeed is exceeded or not)
  5. [5] 1 mark each • Class header (and end where appropriate) inheriting from Vehicle • 3 (private) attribute declarations with data types • Constructor (and end where appropriate) with (min) 5 parameters • Calling parent constructor with appropriate parameters • Initialising VerticalPosition to 0 and VerticalChange and MaxHeight to attributes
  6. [4] 1 mark each to max 4 • Method header (overriding where required) with no parameter • Adding vertical change to vertical position • ...limiting to maximum height • Repeating/calling/using the code from original for horizontal increase (in every case)
  7. [3] 1 mark each to max 3 • Suitable method/procedure heading (and end where appropriate) and outputting horizontal position and current speed in an appropriate message • Checking if object is a Vehicle or Helicopter // overriding methods in each class for output // one method in each class // try except • ...outputting vertical position only if helicopter with appropriate message
  8. [5] 1 mark each • Instantiating an object of type Vehicle with correct parameters ("Tiger", 100, 20) • Instantiating an object of type Helicopter with correct parameters ("Lion", 350, 40, 3, 100) • Calling IncreaseSpeed() twice for the car • Calling IncreaseSpeed() twice for the helicopter • Calling the output for both objects
  9. [1] 1 mark for screenshot e.g. Current position = 60 Current speed = 40 Current position = 120 Current speed = 80 Current verticalposition = 6

Write your answer and get it marked

On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.

Sign up free →

About this question

Topic
Further programming, A-Level Computer Science (syllabus 9618). Structured question, 32 marks.
Source
A-Level Computer Science, May/June 2023 Paper 4 Variant 1, question 2.

Questions and mark schemes are from past examination papers and remain the copyright of the exam board. How Oracle Prep builds its content

Related Computer Science questions

© 2026 Oracle Prep