public interface StrangeDataStructure
The StrangeDataStructure
interface specifies the
behavior (interface) of a data structure. This data structure
accepts integers (via the addElement()
method
and stores them internally.
Any object that implements interface StrangeDataStructure
must implement the methods below.
Method Summary | |
---|---|
void |
addElement(int k)
addElement should take the argument
and store that internally. |
java.util.Enumeration |
evenElements()
Method evenElements should return an
Enumeration of ONLY the odd integers stored. |
int |
getSumOfElements()
Method getSumOfElements should return the sum
of the integers stored. |
java.util.Enumeration |
oddElements()
Method oddElements should return an
Enumeration of ONLY the odd integers stored. |
Method Detail |
---|
void addElement(int k)
addElement
should take the argument
and store that internally. You can use whatever data
structure you like for the internal storage of these integers.
k
- an int
valueint getSumOfElements()
getSumOfElements
should return the sum
of the integers stored.
int
valuejava.util.Enumeration oddElements()
oddElements
should return an
Enumeration
of ONLY the odd integers stored.
Enumeration
valuejava.util.Enumeration evenElements()
evenElements
should return an
Enumeration
of ONLY the odd integers stored.
Enumeration
value