Conditional Statements - Exercise - 08. Scholarship - JAVA
Привет! Виждам ,че тази година няма въпрос за тази задача и понеже изкарвам 81/100 в Judge реших да си споделя кода за коментар:
https://pastebin.com/HkbYkadU или за по мързеливите : ------------------------------------------------------------------------------------------- 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 grade = Double.parseDouble (scanner.nextLine ()); double minWage = Double.parseDouble (scanner.nextLine ()); double socialScholarship = Math.floor (minWage * 0.35); double excellentScholarship = Math.floor (grade * 25); if (income > minWage) { System.out.println ("You cannot get a scholarship!"); } else if (grade < 4.50) { System.out.println ("You cannot get a scholarship!"); } else if (grade < 5.50) { System.out.printf ("You get a Social scholarship %.0f BGN",socialScholarship); } else if (excellentScholarship >= socialScholarship) { System.out.printf ("You get a scholarship for excellent results %.0f BGN",excellentScholarship); } else System.out.printf ("You get a Social scholarship %.0f BGN",socialScholarship); } }
-------------------------------------------------------------------------------------------------------------------------------------------------------
Благодаря за обяснението и за кода. Излежда логично и се чете лесно.Поздрави!
Благодаря! И на мен ми помогна :)