Activity 10.11.1.
Write the method
contains
below in the class MultiGroups.
MultipleGroups
class represents a collection of NumberGroup
objects and is a NumberGroup
. The MultipleGroups
class stores the number groups in the instance variable groupList
(shown below), which is initialized in the constructor.
MultipleGroups
method contains
. The method takes an integer and returns true
if and only if the integer is contained in one or more of the number groups in groupList
.
multiple1
has been declared as an instance of MultipleGroups
and consists of the three ranges created by the calls:
contains
.
contains
below in the class MultiGroups. (Note that the original AP Question involved a NumberGroup interface which has been replaced with inheritance here).
contains
below in the class MultiGroups.