Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle 10g SQL

Authors: Joan Casteel, Lannes Morris Murphy

1st Edition

141883629X, 9781418836290

More Books

Students also viewed these Databases questions