Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Bag ADT Delaware Technical Community College Program Specifications: As we prepare to explore various data structures, it's important to be able to fully understand the
Bag ADT
Delaware Technical Community College
Program Specifications:
As we prepare to explore various data structures, it's important to be able to fully understand the concept of abstraction and apply it to java.
Given a very simple "Bag" abstract data type, look at the given java interface, and implement a concrete ArrayListBag class that provides the functionality using an ArrayList as the storage mechanism.
To Do:
Implement the ArrayListBag according to the intertface
Implement a toString method in the ArrayListBag
Design and implement a test program that creates at minimum:
One bag that contains integers
One bag that contains ALL THE Pokemon from the pokemon CSV file
The bag object should end up with pokemon objects at the end of the program.
Tests removing items, including trying to remove from an empty bag
You'll only be able to test the removeItem on Integers, NOT pokemon. So please make sure you test the remove ONLY with the integer bag.
No user interaction is needed for this program.
Bag Interface:
Starter code for ITN Bag ADT Assignment
Delaware Technical Community College
public interface Bag
@param item the object to be added to the bag
@throws UnsupportedOperationException if the item cannot be added to the bag
public void addT item throws UnsupportedOperationException;
@param item the object to be removed from the bag
@return T the object removed from the bag or null if the object is not found in the bag
public T removeItemT item;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started