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) {
- double quarters;
- double dimes;
- double nickels;
- double pennies;
- double money;
- Scanner scan = new Scanner(System.in);
- System.out.println("Enter the number of quarters in the jar.");
- quarters = scan.nextInt();
- System.out.println("Enter the number of dimes in the jar");
- dimes= scan.nextInt();
- System.out.println("Enter the number of nickels in the jar");
- nickels = scan.nextInt();
- System.out.println("Enter the number of pennies in the jar");
- pennies = scan.nextInt();
- money = quarters*0.25 + dimes*0.10 + nickels*0.05 + pennies*0.01;
- System.out.println("Your total change in dollars and cents is $"+money);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement