Skip to content

Instantly share code, notes, and snippets.

@taylorsmithgg
Last active June 1, 2017 03:57
Show Gist options
  • Save taylorsmithgg/d76c2c12f5a2e8d76c01f537e1e8cfde to your computer and use it in GitHub Desktop.
Save taylorsmithgg/d76c2c12f5a2e8d76c01f537e1e8cfde to your computer and use it in GitHub Desktop.
import java.util.Scanner;
class CalculateTuition {
public static void main(String[] args) {
int tuition = 0;
System.out.println("How many total hours are you taking?");
Scanner scanner = new Scanner(System.in);
int creditHour = Integer.parseInt(scanner.nextLine());
if(creditHour > 0){
System.out.println("How many of those hours are from engineering/science classes? ");
int advancedHour = Integer.parseInt(scanner.nextLine());
if(advancedHour <= creditHour) {
int specialTuition = advancedHour * 25;
tuition += specialTuition;
if (creditHour > 12) {
tuition += 12 * 350;
tuition += (creditHour - 12) * 40;
} else {
tuition += creditHour * 350;
}
} else {
System.out.println("Advanced hours cannot be greater than credit hours");
return;
}
}
System.out.println(tuition);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment