+ Нов въпрос
s.borisov 0 Точки

## 08. Scholarship

Здравевйте,

По-долу е кода на задачата за стипендиите, но един от тестовете в judge не минава. Някой има ли идея къде може да е проблема?

Поздрави!

Стоян

```import java.util.Scanner;

public class Scholarship {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double incomeBGN = Double.parseDouble(scanner.nextLine());
double minSalary = Double.parseDouble(scanner.nextLine());
double socScholarship = 0;
double scholarship = 0;
System.out.println("You cannot get a scholarship!");
} else if (avGrade < 5.50) {
if (incomeBGN < minSalary) {
socScholarship = Math.floor(0.35 * minSalary);
System.out.printf("You get a Social scholarship %.0f BGN", socScholarship);
} else {
System.out.println("You cannot get a scholarship!");
}
} else {
socScholarship = Math.floor(0.35 * minSalary);
if (socScholarship > scholarship) {
System.out.printf("You get a Social scholarship %.0f BGN", socScholarship);
} else {
System.out.printf("You get a scholarship for excellent results %.0f BGN", scholarship);
}
}
}
}```
Тагове:
0
skenderskiantonio 37 Точки

В случай, че оценката е повече от или равна на 5.50, не проверяваш дали доходите са по-малко от минималната заплата. Трябва да се добави проверка за това;

```import java.util.Scanner;

public class Scholarship {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
double incomeBGN = Double.parseDouble(scanner.nextLine());
double minSalary = Double.parseDouble(scanner.nextLine());
double socScholarship = 0;
double scholarship = 0;
System.out.println("You cannot get a scholarship!");
} else if (avGrade < 5.50) {
if (incomeBGN < minSalary) {
socScholarship = Math.floor(0.35 * minSalary);
System.out.printf("You get a Social scholarship %.0f BGN", socScholarship);
} else {
System.out.println("You cannot get a scholarship!");
}
} else {
if (incomeBGN < minSalary) socScholarship = Math.floor(0.35 * minSalary);
if (socScholarship > scholarship) {
System.out.printf("You get a Social scholarship %.0f BGN", socScholarship);
} else {
System.out.printf("You get a scholarship for excellent results %.0f BGN", scholarship);
}
}
}
}```
0
s.borisov 0 Точки

Много благодаря!

0
silly19 4 Точки

Our academic pursuits, along with a range of extracurricular activities, help in honing a child's skills and ensuring that he/she grows to be a mature and responsible citizen.
best cbse school in greater noida

0