SHARE
TWEET

Untitled

a guest Feb 19th, 2020 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class ScholarshipSecondVersion {
  4.     public static void main(String[] args) {
  5.         Scanner term = new Scanner(System.in);
  6.         double income = Double.parseDouble(term.nextLine());
  7.         double averageGrade = Double.parseDouble(term.nextLine());
  8.         double minSalary = Double.parseDouble(term.nextLine());
  9.         if (averageGrade <= 4.50)
  10.         {
  11.             System.out.println("You cannot get a scholarship!");
  12.         }
  13.         else if (averageGrade > 4.50 && averageGrade < 5.50)
  14.         {
  15.             if (income > minSalary)
  16.             {
  17.                 System.out.println("You cannot get a scholarship!");
  18.             }
  19.             else
  20.             {
  21.                 System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(0.35 * minSalary));
  22.             }
  23.         }
  24.         else if (averageGrade >= 5.50)
  25.         {
  26.             if (income < minSalary)
  27.             {
  28.                 double exselentScholarship1 = 0;
  29.                 double exselentScholarship2 = 0;
  30.  
  31.                 exselentScholarship1 = Math.floor(averageGrade * 25);
  32.                 exselentScholarship2 = Math.floor(0.35 * minSalary);
  33.  
  34.                 double scholarship = Math.max(exselentScholarship1, exselentScholarship2);
  35.  
  36.                 if (exselentScholarship1 == scholarship)
  37.                 {
  38.                     System.out.printf("You get a scholarship for excellent results %.0f BGN", scholarship);
  39.                 }
  40.                 else if (exselentScholarship2 == scholarship)
  41.                 {
  42.                     System.out.printf("You get a Social scholarship %.0f BGN", scholarship);
  43.                 }
  44.             }
  45.             else
  46.             {
  47.                 double scholarship = Math.floor(averageGrade * 25);
  48.                 System.out.printf("You get a scholarship for excellent results %.0f BGN", scholarship);
  49.             }
  50.         }
  51.     }
  52. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top