Homework 1: Coins (Data and Expressions)
Due: Lab Period of Week 5
Given an integer number of cents, calculate the minimum number of coins (quarters, dimes, nickels, and pennies) required to make change. Use a variable with an initial value of 68 cents for the calculation. Ensure your program works by testing other values, but submit the version with 68 assigned to the appropriate variable. Display output to the console.
Use good programming style: choose good variable identifiers, write useful comments (including header comments at the beginning of the program), and use white space appropriately to make your program readable... CONTROL-SHIFT-F asks Eclipse to reformat your code with good indentation if it starts to look ragged.
No user input is required. To prepare for subsequent assignments, you may want to research how to obtain the number of cents from the user...don't include it in the version you submit for this assignment, but you can play around with it in preparation for the next lab.
Output the initial cents; and minimum number of quarters, dimes, nickels, and pennies.
Sample Output:
Making change for 42 cents: 1 quarter(s) 1 dime(s) 1 nickel(s) 2 penny(s)
N/A
Use the remainder operator. Ensure your program works for any number of non-negative cents by testing your program with a variety of numbers that you can easily calculate the correct results yourself.
Submit as assignment Coins.