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 scanner = new Scanner(System.in);
- print("Enter in the number of Quarters in the jar: ");
- int quarters = scanner.nextInt() * 25;
- print("Enter in the number of Dimes in the jar: ");
- int dimes = scanner.nextInt() * 10;
- print("Enter in the number of Nickels in the jar: ");
- int nickels = scanner.nextInt() * 5;
- print("Enter in the number of Pennies in the jar: ");
- int pennies = scanner.nextInt();
- int total = quarters + dimes + nickels + pennies;
- System.out.println("The jar contains " + total + " cents.");
- scanner.close();
- }
- public static void print(String in) {
- System.out.print(in);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement