Софтуерно Инженерство
Loading...
+ Нов въпрос
massenova avatar massenova 0 Точки

Scholarship:problem Java

Здравейте,

получавам следната грешка на 3 места/теста в Judge:

The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself.

. Дава ми 81/100 и не успявам да разбера къде е грешката.Кодът,който въвеждам е:

import java.util.Scanner;

public class Scholarship {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        double INCOME = Double.parseDouble(scanner.nextLine());
        double SCORE = Double.parseDouble(scanner.nextLine());
        double MINSALARY = Double.parseDouble(scanner.nextLine());
        double SOCIALSCHOLARSHIP = Math.floor(0.35 * MINSALARY);
        double EXCELLENTSCHOLARSHIP = Math.floor(25 * SCORE);

        if (SCORE < 4.5) {
            System.out.println("You cannot get a scholarship!");
        }else if (SCORE<5.5 && INCOME>=MINSALARY){
            System.out.println("You cannot get a scholarship!");
        }else if (SCORE>=4.5 && INCOME<MINSALARY && SOCIALSCHOLARSHIP>EXCELLENTSCHOLARSHIP){
            System.out.printf("You get a Social scholarship %.0f BGN",SOCIALSCHOLARSHIP);
        }else if (SCORE>=5.5 && EXCELLENTSCHOLARSHIP>=SOCIALSCHOLARSHIP){
            System.out.printf("You get a scholarship for excellent results %.0f BGN", EXCELLENTSCHOLARSHIP);
        }
    }
}

Тагове:
0
Programming Basics with Java
DavideTodorov avatar DavideTodorov 2 Точки

на първия еlse if трябва да ти е ||

и на мен ми дава 93 от 100, 1 проверка не минава каквото и да пробвам

0
radostin.georgiev avatar radostin.georgiev 8 Точки

Примерно решение 100/100.    https://pastebin.com/m52y2d9R 

0
MariaAssenova avatar MariaAssenova 0 Точки

Благодаря, колеги.

Пробвах с варианта на Радостин и стана.

 

0
mitkomik avatar mitkomik 8 Точки

import java.util.Scanner;

public class StependiqUspeh {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        double dohodLv = Double.parseDouble(scanner.nextLine());
        double uspeh = Double.parseDouble(scanner.nextLine());
        double minSalary = Double.parseDouble(scanner.nextLine());
        double socStependiq = Math.floor(minSalary * 0.35);
        double uspehStependiq = Math.floor(uspeh * 25);

        if ((uspeh >= 4.5) & (uspeh < 5.50) & (dohodLv < minSalary)) {
            System.out.printf("You get a Social scholarship %.0f BGN", socStependiq);
        } else if ((uspeh >= 5.50) & (dohodLv > minSalary)) {
            System.out.printf("You get a scholarship for excellent results %.0f BGN", uspehStependiq);
        } else if ((uspeh >= 5.50) & (dohodLv <= minSalary) & (socStependiq >= uspehStependiq)) {
            System.out.printf("You get a Social scholarship %.0f BGN", socStependiq);
        } else if ((uspeh >= 5.50) & (dohodLv <= minSalary) & (socStependiq < uspehStependiq)) {
            System.out.printf("You get a scholarship for excellent results %.0f BGN", uspehStependiq);
        } else {
            System.out.println("You cannot get a scholarship!");
        }
    }
}

0