Question: Hi i am taking a java class and i am stuck on this question. Implement a new class called a bagWithReceipt. This new class is
Hi i am taking a java class and i am stuck on this question.
Implement a new class called a bagWithReceipt. This new class is similar to an ordinary bag, but the data consists of strings, and the way that the strings are added and removed is different. Each time a string is added to a bag with receipts, the add method returns a unique integer called the receipt. Later, when you want to remove a string, you must provide a copy of the receipt as a parameter to the remove method. The remove method removes the item whose receipt has been presented and also returns that item through its return value. You may also have a method that returns a copy of the string without removing it.
You can copy the implementation of the bag and modify it to answer this question.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
