Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Project 2 Tasks: Create a Coin.java class that includes the following: Takes in a coin name as part of the constructor and stores it in

Project 2

Tasks:

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

YOU MUST COMMENT YOUR CODE SO I KNOW WHAT IS HAPPNEING!!!

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

More Books

Students also viewed these Databases questions

Question

c. What groups were least represented? Why do you think this is so?

Answered: 1 week ago