Last active
March 1, 2018 04:07
-
-
Save shawngrimes/253616c58d76b555f25131f315f71418 to your computer and use it in GitHub Desktop.
Java Help
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Bills { | |
public static void main(String[] args) { | |
double johnBills=0; | |
double janeBills=0; | |
Scanner console = new Scanner(System.in); | |
System.out.print("How much will John be spending? "); | |
johnBills = getBills(); | |
System.out.print("How much will Jane be spending? "); | |
janeBills=getBills(); | |
System.out.println("John needs " + johnBills + " bills"); | |
System.out.println("Jane needs " + janeBills + " bills"); | |
console.close(); | |
} | |
public static double getBills (double amount) { | |
Scanner console = new Scanner(System.in); | |
amount = console.nextDouble(); | |
System.out.println(); | |
int numBills = (int) (amount / 20.0); | |
if (numBills * 20.0 < amount) { | |
numBills++; | |
} | |
console.close(); | |
return numBills; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment