Advertisement
Guest User

Untitled

a guest
May 20th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package jar;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Jar {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scan = new Scanner (System.in);
  10.    
  11.         System.out.println("Input the number of Quarters in the Jar");
  12.         int quarters = scan.nextInt();
  13.         int totalQuarters = (quarters * 25);
  14.        
  15.         System.out.println("Input the number of Dimes in the Jar");
  16.         int dimes = scan.nextInt();
  17.         int totalDimes = (dimes * 10);
  18.        
  19.         System.out.println("Input the number of Nickels in the Jar");
  20.         int nickels = scan.nextInt();  
  21.         int totalNickels = (nickels * 5);
  22.        
  23.         System.out.println("Input the number of Pennies in the Jar");
  24.         int pennies = scan.nextInt();
  25.        
  26.         int total = (totalQuarters + totalDimes + totalNickels + pennies);
  27.        
  28.         System.out.println("The jar has " + total + " cents.");
  29.        
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement