Purchase Solution

CoinCounterTest

Not what you're looking for?

Ask Custom Question

GIVEN THE CODE IN THE ATTACHMENT, develop a test program called CoinCounterTest to test the CoinCounter class.

In the test program do the following:

1. Write client code (in the CoinCounterTest.java file) to create a CoinCounter object called counter.

2. Write client code to call the print method of counter.

3. Write client code to deposit 7 quarters, 3 dimes, 10 nickels, and 17 pennies in counter. Output the new status of counter using the toString method.

4. Write client code to put the value of the coins deposited so far into a double variable called totalValue. Then print totalValue with an identifying label.

5. Write client code to deposit an additional 11 quarters, 8 dimes, 0 nickels, and 100 pennies in counter. Again find out and print the value of the total deposits.

6. Write client code to create an additional CoinCounter object called bankCounter. Make deposits of 30 quarters, 90 dimes, 100 nickels, and 1000 pennies to bankCounter.

7. Write client code to print bankCounter using the print method.

8. Write client code to clear bankCounter and print bankCounter using the toString
method.

Part 2: Answer the following questions:

1. What type of value does getTotalDeposit return?

2. Draw a picture of the object variable counter and the object after the first deposit (7 quarters, 3 dimes, 10 nickels, and 17 pennies).

3. Suppose you created a CoinCointer object called count2 and then called count2.deposit(25, 8, 5, 10). What would count2.getTotalDeposit() return?

Attachments
Purchase this Solution

Solution Summary

Develop a test program called CoinCounterTest to test the CoinCounter class.

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

C# variables and classes

This quiz contains questions about C# classes and variables.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.