Computer Science (AS & A Level) · Oct / Nov 2023 · Paper 41 · Question 3
9618
As printed in the paper
The question as text
A computer game is written using object-oriented programming. The game has multiple characters that can move around the screen. The class Character stores data about the characters. Each character has a name, a current X (horizontal) position and a current Y (vertical) position. Character Name : STRING XPosition : INTEGER YPosition : INTEGER stores the name of the character as a string stores the X position as an integer stores the Y position as an integer Constructor() GetXPosition() GetYPosition() SetXPosition() SetYPosition() Move() initialises Name, XPosition and YPosition to its parameter values returns the X position returns the Y position adds the parameter to the X position validates that the new X position is between 0 and 10 000 inclusive adds the parameter to the Y position validates that the new Y position is between 0 and 10 000 inclusive takes a direction as a parameter and calls either SetXPosition or SetYPosition with an integer value
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
3(a)(i)[4]
3(a)(ii)[3]
3(a)(iii)[4]
3(a)(iv)[4]
3(b)[2]
3(c)(i)[3]
3(c)(ii)[2]
3(d)[1]
3(e)(i)[5]
3(e)(ii)[2]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

