Question: Consider the IntArrayBag roughly shown to the right. Show the statements required to complete the following a. Create a new IntArrayBag called bagl with a

 Consider the IntArrayBag roughly shown to the right. Show the statements

Consider the IntArrayBag roughly shown to the right. Show the statements required to complete the following a. Create a new IntArrayBag called bagl with a initial capacity of 12. b. Add 2 items to your IntArrayBag, one at a time. c. Add 3 items to your IntArrayBag in a single statement. d. Count and store the number of 3's in your IntArrayBag. e. Determine the number of " free spots" in your bag the number of elements can you add to the bag before it must resize itself. f. Create a new IntArrayBag that is identical to the current IntArrayBag. public class IntArrayBag implements Cloneable {int[] data; int many Items; public IntArrayBag (int initialCapacity) {...} public void add (int element) {....} public void addMany(int... elements) {...} public IntArrayBag clone (IntArrayBag b) {....} public int countOccurrences (int target) {....} public int getcapacity () {....} public boolean remove (int target) {....} public int size () {....} public void trimTosize () {...} public String toString () {....}}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!