Padd Solutions

Converted by Falcon Hive

import java.util.Scanner;

public class Coins
{
    public static void main (String[] args)
    {
        //How many Quarters do you have? 4
        //How many Dimes do you have? 3
        //How many Nickels do you have? 6
        //How many Pennies do you have? 2
        //Your coins add up to $1.62
        int quarters, dimes, nickels, pennies;
        double q, d, n, p;
       
        Scanner cashier = new Scanner (System.in);
       
        System.out.print ("How many quarters do you have? ");
        quarters = cashier.nextInt ();
       
        System.out.print ("How many dimes do you have? ");
        dimes = cashier.nextInt();
       
        System.out.print ("How many nickels do you have ");
        nickels = cashier.nextInt();
       
        System.out.print ("How many pennies do you have? ");
        pennies = cashier.nextInt();
       
        System.out.println ();
       
       
        q = (quarters * .25);
        d = (dimes * .10);
        n = (nickels * .05);
        p = (pennies * .01);
               
        double totalMoolah = (q + d + n + p);
       
        System.out.println ("Your coins add up to $"+totalMoolah+".");
    }
}
       

(0) Comments

Post a Comment