Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class CountChange {
- public static void main(String[] args) {
- int quarters;
- int dimes;
- int nickels;
- int pennies;
- Double total;
- System.out.println("How many quarters do you have?" );
- quarters = TextIO.getlnInt();
- System.out.println("How many dimes do you have?" );
- dimes = TextIO.getlnInt();
- System.out.println("How many nickels do you have?" );
- nickels = TextIO.getlnInt();
- System.out.println("How many pennies do you have?" );
- pennies = TextIO.getlnInt();
- total = quarters*0.25 + dimes*0.1 + nickels*0.05 + pennies*0.01;
- System.out.println("You have "+total+" dollars.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement