Conditionals Statments Advanced - Exercise - Fishing boat
package ConditionalStatementsAdvanced.Exercises;
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 fisherManNumb = Integer.parseInt(scanner.nextLine());
double boatPrice = 0;
if (season.equals("Spring")) {
boatPrice += 3000;
if (fisherManNumb <= 6) {
boatPrice = boatPrice - boatPrice * 0.1;
} else if (fisherManNumb <= 11) {
boatPrice = boatPrice - (boatPrice * 15 / 100);
} else {
boatPrice = boatPrice - (boatPrice * 25 / 100);
}
} else if (season.equals("Summer") || season.equals("Autumn")) {
boatPrice += 4200;
if (fisherManNumb <= 6) {
boatPrice = boatPrice - boatPrice * 0.1;
} else if (fisherManNumb <= 11) {
boatPrice = boatPrice - (boatPrice * 15 / 100);
} else {
boatPrice = boatPrice - (boatPrice * 25 / 100);
}
} else if (season.equals("Winter")) {
boatPrice += 2600;
if (fisherManNumb <= 6) {
boatPrice = boatPrice - boatPrice * 0.1;
} else if (fisherManNumb <= 11) {
boatPrice = boatPrice - (boatPrice * 15 / 100);
} else {
boatPrice = boatPrice - (boatPrice * 25 / 100);
}
}
if(budget>= boatPrice){
System.out.printf("Yes! You have %.2f leva left.",budget-boatPrice);
}else {
System.out.printf("Not enough money! You need %.2f leva.",Math.abs(budget-boatPrice));
}
}
}
При въвеждане на входа получавам резултатите от word документа, но Judge ми дава 60/100 и не мога да го разбера защо...