Question: Write a method called coinConverter that accepts a single integer parameter representing some number of pennies and prints the correct number of dollars, quarters, dimes,

Write a method called coinConverter that accepts a single integer parameter representing some number of pennies and prints the correct number of dollars, quarters, dimes, and nickels that can be made from the pennies. The method should also print any leftover pennies. This method must be called coinConverter() and its parameter must be an integer. Calling coinConverter(1234) would print the following:

Dollar Bills: 12

Quarters: 1

Dimes: 0

Nickels: 1

Pennies: 4

You can call your method in the program's main method so you can test whether it works, but you must remove or comment out the main method before checking your code for a score. Hint - you might want to review the unit 1 lessons on the use of integer and modular division as you will need to use these in your answer. Start by thinking about how many pennies there are in a single dollar bill, and therefore how you would work out the number of whole dollar bills in a given number of pennies (and how many pennies would be leftover). in 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!