Created
December 14, 2014 01:48
-
-
Save kmb385/cde0409fe5ca2fd6ee86 to your computer and use it in GitHub Desktop.
This file contains 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
public class Assistance { | |
private static Scanner scanner = new Scanner(System.in); | |
public static void main(String[] args) { | |
String choice = null; | |
while(choice == null || !choice.equalsIgnoreCase("no")){ | |
calculateBill(); | |
System.out.println("Do you need to calculate more?"); | |
choice = scanner.nextLine(); | |
} | |
} | |
private static void calculateBill() { | |
System.out.println("How many hours:"); | |
int hours = scanner.nextInt(); | |
System.out.println("Whats your income:"); | |
int income = scanner.nextInt(); | |
doCalculation(hours, income); | |
} | |
private static void doCalculation(int hours, int income) { | |
//I didn't really read the instructions here but I think this gets the point across | |
//do some calculation | |
int amountOwed = hours * income; //just making this up | |
System.out.printf("Pay me now: %s%n", amountOwed); | |
scanner.nextLine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment