Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. public class CountChange {
  2. public static void main(String[] args) {
  3. int quarters;
  4. int dimes;
  5. int nickels;
  6. int pennies;
  7. Double total;
  8. System.out.println("How many quarters do you have?" );
  9. quarters = TextIO.getlnInt();
  10. System.out.println("How many dimes do you have?" );
  11. dimes = TextIO.getlnInt();
  12. System.out.println("How many nickels do you have?" );
  13. nickels = TextIO.getlnInt();
  14. System.out.println("How many pennies do you have?" );
  15. pennies = TextIO.getlnInt();
  16. total = quarters*0.25 + dimes*0.1 + nickels*0.05 + pennies*0.01;
  17. System.out.println("You have "+total+" dollars.");
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement