this is the book name Data Structures and Abstractions with
this is the book name. Data Structures and Abstractions with Java
1) Description: The sample programs in Chapter 1 of your textbook are not complete. They are used for illustration purpose only. The implementation of Listing 1-1 on page 39 is explained in Chapter 2. And, in order to see the result of using it, we will need the following set of files:
i. BagInteface.java – the specification only.
ii. ArrayBag.java – the implementation of BagInerface.java.
iii. ArrayBagDemo.java – a sample program to show us how to use the Bag Interface.
2) Assignment: Download and run the above mentioned programs to ensure they work properly. Study the code and make necessary changes so that the program will run according to the following:
i. Default capacity is 5.
ii. When the current capacity is full, increment the capacity by 3 and resize the array accordingly.
iii. There is no capacity limit.
here are the demo program
Array bag.java // these is the next file
Solution
Make the following changes in the program
1). under the Array bag.java // these is the next file program fille name
BUT YOU CANNOT RESIZE THE ARRAY IN JAVA so you have to create another aaray and copy the content into the new array.
hope the answer meets your requirement .
