Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.74 KB | None | 0 0
  1. package jar;
  2. import java.util.Scanner;
  3.  
  4. public class Jar {
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         print("Enter in the number of Quarters in the jar: ");
  9.         int quarters = scanner.nextInt() * 25;
  10.         print("Enter in the number of Dimes in the jar: ");
  11.         int dimes = scanner.nextInt() * 10;
  12.         print("Enter in the number of Nickels in the jar: ");
  13.         int nickels = scanner.nextInt() * 5;
  14.         print("Enter in the number of Pennies in the jar: ");
  15.         int pennies = scanner.nextInt();
  16.         int total = quarters + dimes + nickels + pennies;
  17.         System.out.println("The jar contains " + total + " cents.");
  18.         scanner.close();
  19.     }
  20.    
  21.     public static void print(String in) {
  22.         System.out.print(in);
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement