В козолата рабоити но на judge е 50%. Уай?
Здравейте!
решавам задача от PB на Java. Уорък е Вложени условни конструкции. За мое съжаление тази задача не може да се провери в judge а момчето което е водило упражнението не я е решило на видеото а в папката на упражнението не са качени отговорите.
В конзолата задачата ми работи с проверките на 100%. В Judge обаче нещо се чупи и той ( ДЖЪДЖА) ми дава само 50%. Халал да са му останалите 50%, обаче не това е проблема. Проблема е, че не знам какво се чупи. При някакво условие задачата не е вярна, но кое е това условие. На предният въпрос видях, че се избихте да ми помагате. Този път не бързайте и не се блъскайте. Все пак ако някой як програмист реши, че може да ми помогне ще съм му много задължен ( никога не знаеш кой ти става задължен в интернет).
Така. Линка към задачата е:
https://softuni.bg/trainings/resources/officedocument/35593/exercise-problem-descriptions-programming-basics-with-java-october-2018/2155
задача №5
Нов дом.
import java.util.Scanner;
public class Task5 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double rosesPrice = 5;
double dahliasPrice = 3.8;
double tulipsPrice = 2.8;
double narcissusPrice = 3;
double gladiolusPrice = 2.5;
String flowers = scanner.nextLine();
int flowersNumber = Integer.parseInt(scanner.nextLine());
double budget = Double.parseDouble(scanner.nextLine());
double price = 0;
if (flowers.equalsIgnoreCase("Roses")) {
if (flowersNumber > 80) {
price = flowersNumber * rosesPrice - (flowersNumber * rosesPrice * 10 / 100);
} else {
price = flowersNumber * rosesPrice;
}
} else if (flowers.equalsIgnoreCase("Dahlias")) {
if (flowersNumber > 90) {
price = flowersNumber * dahliasPrice - (flowersNumber * dahliasPrice * 15 / 100);
} else {
price = flowersNumber * dahliasPrice;
}
} else if (flowers.equalsIgnoreCase("Tulips")) {
if (flowersNumber > 80) {
price = flowersNumber * tulipsPrice - (flowersNumber * tulipsPrice * 15 / 100);
} else {
price = flowersNumber * tulipsPrice;
}
} else if (flowers.equalsIgnoreCase("Narcissus")) {
if (flowersNumber < 120) {
price = flowersNumber * narcissusPrice + (flowersNumber * narcissusPrice * 15 / 100);
} else {
price = flowersNumber * narcissusPrice;
}
} else if (flowers.equalsIgnoreCase("Gladiolus")) {
if (flowersNumber < 80) {
price = flowersNumber * gladiolusPrice + (flowersNumber * gladiolusPrice * 20 / 100);
} else {
price = flowersNumber * gladiolusPrice;
}
}
if (budget > price) {
System.out.printf("Hey, you have a great garden with %d %s and %.2f leva left.", flowersNumber, flowers, (budget - price));
}else{
System.out.printf("Not enough money, you need %.2f leva more.", (price - budget));
}
}
}
Сега се уча и моля да ми простите ако решението е очевидно а аз нямам очи да го видя.
Благодаря ви предварително.
Поздрави,
Александър