Advertisement
silviasj

scholarship

Mar 9th, 2020
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.61 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class GodzillaVsKong_06 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner (System.in);
  6.         double income = Double.parseDouble(scanner.nextLine());
  7.         double grade = Double.parseDouble(scanner.nextLine());
  8.         double salary = Double.parseDouble(scanner.nextLine());
  9.  
  10.         double social = 0.35 * salary;
  11.         double excellent = 25 * grade;
  12.  
  13.         //1. <= 4.5 -> no scholarship
  14.         //2. 4.5 и 5.5
  15.         //3. >= 5.50
  16.  
  17.         if(grade <= 4.50){
  18.             System.out.println("You cannot get a scholarship!");
  19.         }else if (grade > 4.5 && grade < 5.5){
  20.  
  21.             //Social
  22.             if(income < salary){
  23.                 System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(social));
  24.             } else {
  25.                 System.out.println("You cannot get a scholarship!");
  26.             }
  27.         }else if (grade >= 5.50){
  28.             //Excellent -> >= 5.50
  29.             //Social -> >= 4.50  и доход <  заплата
  30.             if (income < salary){
  31.                 //годни за двете стипендии
  32.                 if(social > excellent){
  33.                     System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(social));
  34.                 } else {
  35.                     System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(excellent));
  36.                 }
  37.             } else {
  38.                 System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(excellent));
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement