Interface StrangeDataStructure


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

addElement

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.

Parameters:
k - an int value

getSumOfElements

int getSumOfElements()
Method getSumOfElements should return the sum of the integers stored.

Returns:
an int value

oddElements

java.util.Enumeration oddElements()
Method oddElements should return an Enumeration of ONLY the odd integers stored.

Returns:
an Enumeration value

evenElements

java.util.Enumeration evenElements()
Method evenElements should return an Enumeration of ONLY the odd integers stored.

Returns:
an Enumeration value