Exercise : 1.40. Instructions: Making change

If you haven’t already done so, accept the Exercises repository via this link and follow the process described in Assignment 0 on Accepting a new assignment and Adding an assignment to Eclipse.

Look inside the exercises source folder and you will see assignments organized by name. Before continuing on to the next portion of the prep material, spend some time on the exercise.

It is not so important that you get the exercise exactly right. It is important to work through it as best you can before you look at the solution or continue with other work in this module.

You have some number of pennies, and you would like to determine how to make change for those pennies to obtain the proper number of each of the following currencies:

currency pennies
dollars 100
quarters 25
dimes 10
nickels 5

In making change, we seek the maximum number of each denomination in decreasing order. For example, given 798 pennies, your program should print the following:

For 798 pennies:
7 dollars
3 quarters
2 dimes
0 nickels
3 pennies


  • Find and open the Change Java program in the exercises1 package of the exercises source folder.
  • Add code as directed there to prompt the user to supply the number of pennies.
  • Compute and print the output as suggested above.


  • You need to use integer division and remainder (%) to complete this exercise.
  • Review the video materials as necessary for this module.