Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package jar;
- import java.util.Scanner;
- public class Jar {
- public static void main(String[] args) {
- Scanner scan = new Scanner (System.in);
- System.out.println("Input the number of Quarters in the Jar");
- int quarters = scan.nextInt();
- int totalQuarters = (quarters * 25);
- System.out.println("Input the number of Dimes in the Jar");
- int dimes = scan.nextInt();
- int totalDimes = (dimes * 10);
- System.out.println("Input the number of Nickels in the Jar");
- int nickels = scan.nextInt();
- int totalNickels = (nickels * 5);
- System.out.println("Input the number of Pennies in the Jar");
- int pennies = scan.nextInt();
- int total = (totalQuarters + totalDimes + totalNickels + pennies);
- System.out.println("The jar has " + total + " cents.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement