Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A collection, as its name implies, is a group of objects. This ADT provides the ability to store information and then access the stored

image text in transcribed

A collection, as its name implies, is a group of objects. This ADT provides the ability to store information and then access the stored information. It can also achieve all the operations that you perform on data such as searching, sorting, insertion, manipulation, and deletion. For this guided assignment, we capture the formal specifications of our Collection ADT using the Java interface construct. Our collections are generic-the type of object held by any particular collection is indicated by the client at the time the list is instantiated. Please study the interface, as well as all other already implemented methods, and implement two methods as specified in CollectionT.java. For this assignment, we developed an array-based implementation of our Collection ADT. One limitation of arrays is that they're fixed-sized, meaning you need to specify the number of elements your array will hold ahead of time. A dynamic array expands as you add more elements. So you don't need to determine the size ahead of time. In our implementation, when the array is full, dynamic arrays automatically make a new, bigger underlying array by doubling the array size, and each item has to be individually copied into the new array. However, copying each item over costs O(n)time! So whenever the array is full, adding an item to our dynamic array forces us to make a new double-size underlying array that append takes O(n) time. That's the worst case. But in the best case (and the average case), appends are just O(1)time. Your Tasks: Please follow the steps to complete this guided assignment: 1. Download CollectionInterface.java and CollectionT.txt. Rename CollectionT.txt to CollectionT.java. 2. Study the code and make sure you understand all methods implemented in CollectionT.java before moving to the next step. 3. Implement add(T ele), remove(int index), and remove(T ele) methods as specified in the template. 4. Design a driver program to test your implementation as follows: a. Create an Integer type CollectionT object. b. Add a few Integers to the collection object, then call each method to verify all work as expected. You may add or remove items several times in this testing process. c. You may call print method to display the collection content to examine how the transformer methods modify the collection. 5. If all the required methods are implemented properly, the driver program should generate outputs similar to the following: Before adding any item, the collection is empty: true [A, B, A] Collection size = 3 after calling remove (1) [A, A] after calling remove ("A") |[] 6. Please include the following in the Word document you created for the assignment for the final submission: Your completed code in CollectionT.java A screenshot of the running output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Networking A Top-Down Approach

Authors: James Kurose, Keith Ross

7th edition

978-0133594140

More Books

Students also viewed these Computer Network questions

Question

How is the cost of goods sold calculated when preparing a budget?

Answered: 1 week ago

Question

understand gender differences with regard to work-related outcomes;

Answered: 1 week ago