3. Vacation
https://softuni.bg/trainings/resources/officedocument/49522/basic-syntax-conditional-statements-and-loops-exercise-java-fundamentals-may-2020/2831 Judge ми дава 91/100. Къде греша? import java.util.Scanner; public class Vacation { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int people = Integer.parseInt(scanner.nextLine()); String type = scanner.nextLine(); String day = scanner.nextLine(); double singlePrice = 0; double totalPrice = 0; if (day.equals("Friday")) { if ("Students".equals(type)) { singlePrice = 8.45; totalPrice = people * singlePrice; if (people >= 30){ totalPrice= totalPrice - (totalPrice * 0.15); } } else if ("Business".equals(type)) { singlePrice = 10.90; totalPrice = people * singlePrice; if (people >= 100){ totalPrice= (people - 10) * singlePrice; } } else if ("Regular".equals(type)) { singlePrice = 15; totalPrice = people * singlePrice; if (people >= 10 && people <= 20){ totalPrice = totalPrice - (totalPrice * 0.05); } } } else if (day.equals("Saturday")) { if ("Students".equals(type)) { singlePrice = 9.80; totalPrice = people * singlePrice; if (people >= 30){ totalPrice= totalPrice - (totalPrice * 0.15); } } else if ("Business".equals(type)) { singlePrice = 15.60; totalPrice = people * singlePrice; if (people >= 100){ totalPrice= totalPrice - (10 * 10.98); } } else if ("Regular".equals(type)) { singlePrice = 20; totalPrice = people * singlePrice; if (people >= 10 && people <= 20){ totalPrice = totalPrice - (totalPrice * 0.05); } } } else if (day.equals("Sunday")) { if ("Students".equals(type)) { singlePrice = 10.46; totalPrice = people * singlePrice; if (people >= 30){ totalPrice= totalPrice - (totalPrice * 0.15); } } else if ("Business".equals(type)) { singlePrice = 16; totalPrice = people * singlePrice; if (people >= 100){ totalPrice= totalPrice - (10 * 10.98); } } else if ("Regular".equals(type)) { singlePrice = 22.50; totalPrice = people * singlePrice; if (people >= 10 && people <= 20){ totalPrice = totalPrice - (totalPrice * 0.05); } } } System.out.printf("Total price: %.2f%n", totalPrice); } }
Друго решение https://pastebin.com/Q88ns8Yy