Advertisement
mcnealk

#12

Oct 23rd, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. * @author Kailey McNeal
  2. * @version 10-23-14
  3. * p.301 #12
  4. */
  5. import java.util.*;
  6. public class Twelve
  7. {
  8. public static void main (String[]args)
  9. {
  10. Scanner console=new Scanner(System.in);
  11. System.out.print("How much will John be spending? ");
  12. double amount=console.nextDouble();
  13. double john=spend(amount);
  14. System.out.print("How much will Jane be spending? ");
  15. amount=console.nextDouble();
  16. double jane=spend(amount);
  17. System.out.println("John needs " + john + "bills");
  18. System.out.println("Jane needs " + jane + "bills");
  19. }
  20. public static double spend(double amount)
  21. {
  22. int numBills=(int) (amount/20.0);
  23. if (numBills*20.0<amount)
  24. {
  25. numBills++;
  26. }
  27. return numBills;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement