Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class jar {
- public static void main (String[] args){
- Scanner scan= new Scanner(System.in);
- System.out.println("Enter in the number of Quarters in the Jar: ");
- int x =scan.nextInt();
- int quarters = x * 25;
- System.out.println("Enter in the number of Dimes in the Jar: ");
- int y =scan.nextInt();
- int dimes = y * 10;
- System.out.println("Enter in the number of Nickles in the Jar: ");
- int z =scan.nextInt();
- int nickles = z * 5;
- System.out.println("Enter in the number of Pennies in the Jar: ");
- int p =scan.nextInt();
- int total = quarters+dimes+nickles+p;
- System.out.println("The jar contains " + total + " cents." );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement