Question 2(b)(i) 2024 · October-November · Paper 41 · 5 marks
Reveal official mark-scheme answer
Official answer for Question 2
Part (b)
(i)
Question 1
mark each
Question 5
- Instantiating one object of type Horse with correct data …
- … and storing in first element of a 1D array Horses
- Instantiating second object of type Horse with correct data and storing in second index of the array
- Outputting name of both horse objects from array …
- … using GetName()
Show text version of question
Question 2
Part (b)
(i)
Question 2
A computer program is designed to simulate horses doing show jumping. In show jumping, horses
jump over obstacles called fences. A horse successfully jumps a fence if it does not knock the fence down.
The program is written using Object-Oriented Programming (OOP).
The class Horse stores data about the horses.
Horse
Name : STRING stores the name given to the horse
MaxFenceHeight : INTEGER stores the maximum height in cm that the horse can jump, for example 132
PercentageSuccess : INTEGER stores the percentage chance of a horse not knocking down a fence, for example 70 represents a 70% chance of jumping a fence successfully Constructor() initialises Name, MaxFenceHeight and PercentageSuccess to its parameter values
GetName() returns the name of the horse
GetMaxFenceHeight() returns the maximum height the horse can jump
Success() calculates and returns the percentage chance of a horse successfully jumping a specific fence The array Horses stores objects of type Horse.
(i)
The program has two horses:
- The horse named ‘Beauty’ can jump a maximum height of 150 cm and has a success
- The horse named ‘Jet’ can jump a maximum height of 160 cm and has a success
percentage rate of 72%.
percentage rate of 65%.
Write program code to:
- declare the array, Horses, local to the main program with space for two Horse
- store the two horses described in the array
- output the name of both Horse objects from the array.
objects
Save your program.
Copy and paste the program code into part 2(b)(i) in the evidence document.
Why this question appears here
98% assigned-topic match · Further programming › Programming paradigms
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_w24_qp_41.pdf
