Question 5(c) 2018 · October-November · Paper 43 · 2 marks
Reveal official mark-scheme answer
Official answer for Question 5
Part (c)
Question 1
mark per bullet point to max 2:
Question 2
Show text version of question
Question 5
Part (c)
Question 5
A game uses a set of cards. Each card has a number (between 0 and 9 inclusive) and a shape
("square", "triangle" or "circle").
The game is written using object-oriented programming.
The class, Cards, has the private properties:
- Number
- Shape
and the methods:
- Constructor()
- GetNumber()
- GetShape()
The purpose of each method in the class Cards is given in the following table.
Method Purpose Constructor() Takes a number and a shape as parameters Checks that the number and the shape are valid and:
- either assigns the parameters to Number and Shape
- or reports an error.
GetNumber() A public method that returns the number for that card. GetShape() A public method that returns the shape for that card.
Part (c)
Write program code for the GetNumber() method.
Programming language ............................................................................................................
Program code
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
...................................................................................................................................................
..............................................................................................................................................
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 9608_w18_qp_43.pdf
