Advertisement
Guest User

jar

a guest
Jan 26th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.79 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class jar {
  3.     public static void main (String[] args){
  4.  
  5.         Scanner scan= new Scanner(System.in);
  6.  
  7.         System.out.println("Enter in the number of Quarters in the Jar: ");
  8.         int x =scan.nextInt();
  9.  
  10.         int quarters = x * 25;
  11.  
  12.         System.out.println("Enter in the number of Dimes in the Jar: ");
  13.         int y =scan.nextInt();
  14.  
  15.         int dimes = y * 10;
  16.  
  17.         System.out.println("Enter in the number of Nickles in the Jar: ");
  18.         int z =scan.nextInt();
  19.  
  20.         int nickles = z * 5;
  21.  
  22.         System.out.println("Enter in the number of Pennies in the Jar: ");
  23.         int p =scan.nextInt();
  24.  
  25.  
  26.         int total = quarters+dimes+nickles+p;
  27.  
  28.  
  29.         System.out.println("The jar contains " + total + " cents." );
  30.  
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement