#javaPB Fishing Boat
Здравейте! Публикувам кода си за задача Fishing Boat. Judge ми дава 86 точки и не мога да си открия пропуските. Ако някой би могъл да помогне, благодаря предварително!
import java.util.Scanner;
public class FishingBoat {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int budget = Integer.parseInt(scanner.nextLine());
String season = scanner.nextLine();
int fishers = Integer.parseInt(scanner.nextLine());
double cost = 0.00;
switch (season) {
case "Spring":
cost = 3000;
if (fishers <= 6) {
cost *= 0.9;
} else if ( fishers <= 11) {
cost *= 0.85;
} else {
cost *= 0.75;
}
break;
case "Summer":
case "Autumn":
cost = 4200;
if (fishers <= 6) {
cost *= 0.9;
} else if ( fishers <= 11) {
cost *= 0.85;
} else {
cost *= 0.75;
}
break;
case "Winter":
cost = 2600;
if (fishers <= 6) {
cost *= 0.9;
} else if (fishers <= 11) {
cost *= 0.85;
} else {
cost *= 0.75;
}
break;
}
if (!"Autumn".equals(season) && fishers % 2 == 0) {
cost *= 0.95;
}
if (budget <= cost) {
double moneyNeeded = cost - budget;
System.out.printf("Not enough money! You need %.2f leva.", moneyNeeded);
} else {
double moneyLeft = budget - cost;
System.out.printf("Yes! You have %.2f leva left.", moneyLeft);
}
}
}