Toy Shop JAVA
Линк към условието: https://softuni.bg/trainings/resources/officedocument/35389/lab-problem-descriptions-programming-basics-with-java-october-2018/2155 Здравейте, това е решението на задачата. В judge ми дава 60/100 точки, но не мога да си намеря грешката. import java.util.Scanner; import java.util.ServiceConfigurationError; public class Demo { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double trip = Double.parseDouble(scanner.nextLine()); int puzzle = Integer.parseInt(scanner.nextLine()); int doll = Integer.parseInt(scanner.nextLine()); int bears = Integer.parseInt(scanner.nextLine()); int minions = Integer.parseInt(scanner.nextLine()); int truck = Integer.parseInt(scanner.nextLine()); double puzzlePrice = 2.60; int dollPrice = 3; double bearsPrice = 4.10; double minionsPrice = 8.20; int truckPrice = 2; double sum = puzzle * puzzlePrice + doll * dollPrice + bears * bearsPrice + minions * minionsPrice + truck * truckPrice; // сума int numberOfToys = puzzle + doll + bears + minions + truck; if (numberOfToys >= 50) { double discount = sum * 0.25; double sumMinusDiscount = sum - discount; // крайна цена double rent = 0.10 * sumMinusDiscount; double income = sumMinusDiscount - rent; if (income >= trip) { double spare = income - trip; System.out.printf("Yes! %.2f lv left.", spare); } } if (numberOfToys < 50) { double rentTwo = 0.10 * sum; double incomeTwo = sum - rentTwo; if (incomeTwo < trip) { double notEnough = trip - incomeTwo; System.out.printf("Not enough money! %.2f lv needed.", notEnough); } } } }
Да, благодаря. Видях къде греша.
Здравейте, какво всъщност импортвате чрез "java.util.ServiceConfigurationError"? Judge ми прие кода и без него, нито IntelliJ ми казва, че имам нужда от него.