DavidPeikrishvili1

David's Homework Java

Nov 12th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.34 KB | None | 0 0
  1. //David Peikrishvili
  2. //11/12/2015
  3. import java.util.*;
  4. import java.text.DecimalFormat;
  5.  
  6. public class PiggyBank
  7. {
  8.   public static void main (String[] args)
  9.   {
  10.    
  11.     DecimalFormat df = new DecimalFormat("$00.00");
  12.     Scanner input = new Scanner(System.in);
  13.     double penny, nickels, dimes, quarter, time;
  14.     System.out.println("Welcome, please enter your name!!!");
  15.     String name = input.nextLine();
  16.     System.out.println("Please enter how many pennies do you have!");
  17.     double  pennies = input.nextDouble();
  18.     System.out.println("Please enter how many nickels you have!");
  19.     nickels = input.nextDouble();
  20.     System.out.println("Please enter how many dimes you have!");
  21.     dimes = input.nextDouble();
  22.     System.out.println("Please enter how many quarters you have!");
  23.     quarter = input.nextDouble();
  24.     System.out.println("How many weeks/days have you been saving?");
  25.     time = input.nextDouble();
  26.     // Calculations
  27.    
  28.       double quot = (pennies + nickels + dimes + quarter)/4;
  29.     // The outputs
  30.     System.out.println("You have");
  31.     System.out.println("Pennies - " + pennies);
  32.     System.out.println("Nickles - " + nickels);
  33.     System.out.println("Dimes - " + dimes);
  34.     System.out.println("Quarters - " + quarter);
  35.     System.out.println("You saved - " + quot + time);
  36.   }//close main
  37. }// close class
Advertisement
Add Comment
Please, Sign In to add comment