Question: program output public class CostCalculator { public static int calculateCost(int age, int units) { int cost; if (age > 17 && age 15) { cost
program output
public class CostCalculator { public static int calculateCost(int age, int units) { int cost; if (age > 17 && age <= 29) { if (units > 15) { cost = (units - 15) * 400; } else { cost = 0; } } else { if (units < 12) { cost = units * 400; } else { cost = (units - 11) * 500 + 300; } } return cost; } public static void main(String[] args) { int costReturned = calculateCost(34, 19); System.out.println(costReturned); } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
