In this project you will write the code to implement a dynamic (node-based) bag. Use the Node-based BAG code as a starting point and add the required code to fully implement it. For this assignment we will use a bag of coins. A bag of coins is a simply a bag that contains a set of coins objects. The user enters the coin value. Then, you create a coin object and add it to the bag.

Specifications:

I. Class Coin: There is only four coin values: 10 cents, 25 cents, 75 cents and 100 cents. Other values are not allowed. The class is very simple has only one data member coinValue. But you might need to override methods such as: toString, equal, and compareTo.

II. A bag of coins: Use the node based BAG. The bag should support the following Operations:

(a) Add a coin : When called the following steps happen :

1. the user is asked to enter the value of the coin then the coin created with the specific value and added to the bag.
2. Add the coin object to the bag

(b) Removing a coin: When called, you should remove the last coin added to the bag

(c) Removing a specific coin: When called you should ask the user to specify the value of the coin you want to remove, based in that you search the bag and remove a coin of the same value. If the coin doesn't exist then you display a message indicating that the specific coin doesnt exist in the bag

(d) Clear the bag: This method resets every thing i.e. clears the bag.

(e) Get frequency: When called, you should ask the user to specify the coin value. Based on that, you return the number of occurrences of that value.

(f) Check if Exist: When called, you ask the user the coin value he/she want to check. You search for it, if the coin of that value exist you display a message indicating its existence, otherwise you display a message that the coin is not in the bag.

(g) Get minimum coin : returns the smallest coin value in the bag and print it

(h) Get maximum coin: returns the largest coin value found in the bag and print it

(i) Print contents: You print the bag contents as is.

(j) Print contents sorted: You print the content sorted in ascending order ( Note: you should not change the original bag content, just print them on order based on their value)

The menu that appears to the user should like this:

[1] Adding a coin
[2] Removing a coin
[3] Removing a specific coin
[4] Clear the bag
[5] Get the frequency of a given coin
[6] Check if specific coin exists in the bag
[7] Get minimum coin value
[8] Get maximum
[9] Print bag contents
[10] Print bag contents ordered
[11] Exit
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.