Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- * @author Kailey McNeal
- * @version 10-23-14
- * p.301 #12
- */
- import java.util.*;
- public class Twelve
- {
- public static void main (String[]args)
- {
- Scanner console=new Scanner(System.in);
- System.out.print("How much will John be spending? ");
- double amount=console.nextDouble();
- double john=spend(amount);
- System.out.print("How much will Jane be spending? ");
- amount=console.nextDouble();
- double jane=spend(amount);
- System.out.println("John needs " + john + "bills");
- System.out.println("Jane needs " + jane + "bills");
- }
- public static double spend(double amount)
- {
- int numBills=(int) (amount/20.0);
- if (numBills*20.0<amount)
- {
- numBills++;
- }
- return numBills;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement