Quelpr

CAPE Computer Science Unit 2 · 2006 · Paper 2 · Question 6(b)(ii)

Write a code fragment to create/instantiate a named data structure to store all Product objects and add the two Product objects from 6(b)(i) to it.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 6(a)Write the code for the Product class including the instance variables, constructor, accessor methods, toString() method, and the methods reduceItems(int amt)…[16 marks]
  2. 6(b)(i)Write a code fragment to instantiate TWO Product objects using arbitrary data and assign them to separate variables.[2 marks]
  3. 6(b)(iii)Write code to print the names of all Product objects in the data structure that need to be reordered.[5 marks]
  4. 6(c)Discuss the easiest way to reuse the functionality of the Product class in another application that requires additional instance variables and an alternate…[4 marks]

More practice: the rest of this paper · more Abstract Data Types (ADTs) questions · all CAPE Computer Science Unit 2 past papers