Question: Create a Coin.java class that includes the following: Takes in a coin name as part of the constructor and stores it in a private string

Create a Coin.java class that includes the following:

Takes in a coin name as part of the constructor and stores it in a private string

Has a method that returns the coins name

Has an abstract getvalue method

Create four children classes of Coin.java with the names Penny, Nickle, Dime, and Quarter that includes the following:

A constructor that passes the coins name to the parent

A private variable that defines the value of the coin

A method that returns the coins name via the parent class

And any other methods that should be required.

Create a Pocket class that includes the following:

An ArrayList of type coin to manage coins.(You MUST use an ARRAYLIST)

A method that allows a coin to be added

A method that allows a coin to be removed

A method that returns a count of the coins in your arraylist by coin type.

A method that returns a total value of all the coins in your arraylist

Create a NoSuchCoin class that will act as your custom exception (see pg.551 in book).

Create a PocketMain class that includes the following :

Creates an object of type pocket to be used below

A main method that prompts the user with a menu of options to include:

Add a coin (must specify type)

Remove a coin (must specify type)

Display a coin count

Display a total value in the pocket

An ability to exit the program

This method must handle poor user input somehow using your custom exception

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!