Advertisement
damesova

Scholarship

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