package rebelsky.exam2.solutions; import rebelsky.io.Pen; /** * Some tests of our coin counter. * * @author Samuel A. Rebelsky * @version 1.0 of October 2004 */ public class TestCoinCounter { public static void main(String[] args) { Pen pen = new Pen(); int[] denoms = new int[] { 2, 5, 8, 25, 50 }; CoinCounter cc = new CoinCounter(denoms); pen.println("Denominations: 2, 5, 8, 25, 50"); for (int price = 0; price <= 60; price++) { try { cc.resetCalls(); pen.println("A price of " + price + " requires " + cc.fewestCoins(price)); pen.println(" Took: " + cc.getCalls() + " calls."); } catch (Exception e) { pen.println("Can't make change for " + price); } } // for } // main(String[]) } // TestCoinCointer