/*
 * ChangeAdder4.java
 * Dave Sullivan (dgs@cs.bu.edu)
 *
 * This program determines the value of some coins as an integral number
 * of dollars, with the remaining value expressed in cents.
 * 
 * This version also uses simple conditional execution (if or if-else)
 * to decide whether to print "dollars" or "dollar", and "cents" or "cent".
 */

public class ChangeAdder4 {
    public static void main(String[] args) {
        // Try changing some of these to see if you can get 
        // "dollar" and/or "cent" to be printed.
        int quarters = 10;
        int dimes = 3;
        int nickels = 7;
        int pennies = 6;
        int dollars, cents;        

        // total cents
        cents = 25*quarters + 10*dimes + 5*nickels + pennies;
        
        // integral number of dollars
        dollars = cents / 100;

        // remaining cents
        cents = cents % 100;

        System.out.print(dollars);
        if (dollars == 1) {
            System.out.print(" dollar, ");
        } else {
            System.out.print(" dollars, ");
        }

        System.out.print(cents + " cent");
        if (cents != 1) {
            System.out.print("s");     // only print if cents is not 1
        }
        System.out.println();
    }
}
