Advertisement
Lyubohd

08. Scholarship

Jan 25th, 2020
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.21 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.    public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.        
  7.         double income = Double.parseDouble(scan.nextLine());
  8.         double avgGrade = Double.parseDouble(scan.nextLine());
  9.         double minSalary = Double.parseDouble(scan.nextLine());
  10.  
  11.         double excellentResultScholarship = 0.0;
  12.         double socialScholarship = 0.0;
  13.  
  14.         if (avgGrade >= 5.50) {
  15.             excellentResultScholarship = avgGrade * 25;
  16.         }
  17.         if (income < minSalary && avgGrade > 4.50) {
  18.             socialScholarship = minSalary * 0.35;
  19.         }
  20.  
  21.         if (excellentResultScholarship == 0 && socialScholarship == 0) {
  22.             System.out.println("You cannot get a scholarship!");
  23.         } else if (excellentResultScholarship >= socialScholarship) {
  24.             System.out.printf("You get a scholarship for excellent results %.0f BGN",
  25.                     Math.floor(excellentResultScholarship));
  26.         } else if (socialScholarship > excellentResultScholarship) {
  27.             System.out.printf("You get a Social scholarship %.0f BGN",
  28.                     Math.floor(socialScholarship));
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement