Java Basics-Conditional Statements - задача "Godzilla vs. Kong"
Здравейте! Направих тази задача ,но в Judge ми дава резултат 40/100. Дали някой може да ми помогне да открием грешката?
package conditionalStatements;
import java.util.Scanner;
public class GodzillaVsKong {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
double budget = Double.parseDouble(scan.nextLine());
int people = Integer.parseInt(scan.nextLine());
double clothePrice = Double.parseDouble(scan.nextLine());
double decorPrice = budget * 0.10;
if (people > 150) {
clothePrice = clothePrice - (0.10 * clothePrice);
}
double totalExpenses = clothePrice * people + decorPrice;
String output = "";
if (budget >= totalExpenses) {
output = String.format("Action!%n" +
"Wingard starts filming with %.2f leva left.", budget - totalExpenses);
} else {
output = String.format("Not enough money!%n" +
"Wingard needs %.2f leva more.", totalExpenses - budget);
System.out.println(output);
}
}
}