Question: Write a class encapsulation the concept of coins (Coins java), assuming that coins have the following attributes: a number of quarters, a number of dims,

 Write a class encapsulation the concept of coins (Coins java), assuming

Write a class encapsulation the concept of coins (Coins java), assuming that coins have the following attributes: a number of quarters, a number of dims, a number of nickels, and a number of pennies. Include a constructor (accept 4 numbers that represent the number of coins for each coin type), mutator and accessot methods, and method tostring. The tostring method should return a string in the following format: Total Value: $5.50 10 quarters, 20 dimes, 19 nickels, and 5 pennies Also code the following methods: public double totalAmount(, which returns the mount of money in dollar notation with two significant digits after the decimal point. Write a client class named CoinsTester.java to test all the methods in your Coins.java

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!