# Answer to Question #54649 in Java | JSP | JSF for AJ

Question #54649

A bag in java is a kind of collection that doesn’t do much more than contain its items. It does not order the items in any particular order and nor does it prevent duplicates. Develop a java interface named Bag that can store a certain number of whole numbers in it. Provide the following methods in the interface.

• getCurrentSize( ) that returns a count of numbers in the bag

• isEmpty( ) – that checks if the bag is empty

• add (int num) – adds a new number num to the bag

• remove (int num) – removes the first occurrence of the number num from the bag

• remove( ) – removes randomly a number from the bag

• clear( ) – removes all the numbers from the bag

• getFrequencyOf(int num) – counts the number of times the number num exists in the bag

• contains(int num) – Tests whether the bag contains the number num.

• getCurrentSize( ) that returns a count of numbers in the bag

• isEmpty( ) – that checks if the bag is empty

• add (int num) – adds a new number num to the bag

• remove (int num) – removes the first occurrence of the number num from the bag

• remove( ) – removes randomly a number from the bag

• clear( ) – removes all the numbers from the bag

• getFrequencyOf(int num) – counts the number of times the number num exists in the bag

• contains(int num) – Tests whether the bag contains the number num.

Expert's answer

#### Not answered

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment