Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //David Peikrishvili
- //11/12/2015
- import java.util.*;
- import java.text.DecimalFormat;
- public class PiggyBank
- {
- public static void main (String[] args)
- {
- DecimalFormat df = new DecimalFormat("$00.00");
- Scanner input = new Scanner(System.in);
- double penny, nickels, dimes, quarter, time;
- System.out.println("Welcome, please enter your name!!!");
- String name = input.nextLine();
- System.out.println("Please enter how many pennies do you have!");
- double pennies = input.nextDouble();
- System.out.println("Please enter how many nickels you have!");
- nickels = input.nextDouble();
- System.out.println("Please enter how many dimes you have!");
- dimes = input.nextDouble();
- System.out.println("Please enter how many quarters you have!");
- quarter = input.nextDouble();
- System.out.println("How many weeks/days have you been saving?");
- time = input.nextDouble();
- // Calculations
- double quot = (pennies + nickels + dimes + quarter)/4;
- // The outputs
- System.out.println("You have");
- System.out.println("Pennies - " + pennies);
- System.out.println("Nickles - " + nickels);
- System.out.println("Dimes - " + dimes);
- System.out.println("Quarters - " + quarter);
- System.out.println("You saved - " + quot + time);
- }//close main
- }// close class
Advertisement
Add Comment
Please, Sign In to add comment