[SOLVED] CS212 Lab 17-Extending a Class: Money

25.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Lab17-mdngwb.zip (34.5 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
πŸ”’ Securely Powered by:
Secure Checkout
Rate this product

Extending a Class: Money.

Create a new project in Eclipse called Lab 17, and import the files from Z:\Lab17.

Open all the files.

Observe the class hierarchy
The abstract class Money extends to Bill and Coin. Coin extends to Quarter.

Read through the MoneyMain application and understand how it works. Write classes for Penny, Nickel and Dime using class Quarter as a reference.

Add some pennies, nickels and dimes to the dataSource array and modify the main method so that it will add pennies, nickels and dimes to the wallet.

Run the main application to see that it works.

Notice in the method printWallet that the output string for a Bill is complicated and the output string for a Coin is simple. This is because Coin has a toString method. Provide class Bill with a similar toString method and rewrite the output string in printWallet for the Bills.

Write a method for the main application called sumWallet which adds all the money in the wallet and prints the amount to the console.

  • Lab17-mdngwb.zip