Fishing Boat Problem
Здравейте, Judge ми дава 86/100, но не намирам къде би могла да ми бъде грешката.
package conditionalStatementsAdvancedExercise; import java.util.Scanner; public class P04fishingBoat { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int budget = Integer.parseInt(scanner.nextLine()); String time = scanner.nextLine(); int numFisherman = Integer.parseInt(scanner.nextLine()); double price = 0; if (time.equals("Spring")){ price = 3000; }else if(time.equals("Summer")){ price = 4200; }else if(time.equals("Autumn")){ price = 4200; }else if(time.equals("Winter")){ price = 2600; } if (numFisherman <= 6){ price = price - price * 0.1; }else if (numFisherman >= 7 && numFisherman <= 11){ price = price - price * 0.15; }else if (numFisherman >= 12){ price = price - price * 0.25; } if (numFisherman % 2 == 0 && (time.equals("Spring") || time.equals("Summer")|| time.equals("Winter"))){ price = price - price * 0.05; } if (budget <= price){ System.out.printf("Not enough money! You need %.2f leva.", Math.abs(price - budget)); }else { System.out.printf("Yes! You have %.2f leva left.", Math.abs(budget - price)); } } }
Много ти благодаря! Извинявам се, че не уточних!