Question 2(c) 2023 · May-June · Paper 41 · 3 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (c)
Question 1
mark each to max 3
Question 3
Show text version of question
Question 2
Part (c)
Question 2
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
Part (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.
Save your program.
Copy and paste the program code into part 2(c) in the evidence document.
Why this question appears here
71% assigned-topic match · Programming › Constructs
Topic-match percentages estimate how closely each question fits the selected syllabus topic. They are a guide for choosing stricter or broader practice.
Permanent source page: Educate A Change · From 9618_s23_qp_41.pdf
