Advertisement
Guest User

Scholarship_SoftUni

a guest
Sep 19th, 2019
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.54 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Scholarship3 {
  4.     public static void main(String[] args) {
  5.         Scanner scan = new Scanner(System.in);
  6.  
  7.         double dohod =Double.parseDouble(scan.nextLine());
  8.         double uspeh=Double.parseDouble(scan.nextLine());
  9.         double minSalary=Double.parseDouble(scan.nextLine());
  10.  
  11.         double stipendiqSocial = 0.35 * minSalary;
  12.         double stipendiqOtlichen = uspeh * 25;
  13.  
  14.         boolean qualified = false;
  15.         boolean qualifiedUspeh = false;
  16.  
  17.         if (dohod < minSalary && uspeh > 4.50) {
  18.             qualified = true;
  19.         } else {
  20.             qualified = false;
  21.  
  22.         }
  23.         if (uspeh >= 5.50) {
  24.             qualifiedUspeh = true;
  25.         } else {
  26.             qualifiedUspeh = false;
  27.         }
  28.  
  29.         if (!(qualified == qualifiedUspeh)) {
  30.             System.out.println("You cannot get a scholarship!");
  31.         } else if (qualified == qualifiedUspeh && stipendiqSocial>stipendiqOtlichen) {
  32.             System.out.printf("You get a Social scholarship %.0f BGN", stipendiqSocial);
  33.         } else if (qualified == qualifiedUspeh && stipendiqSocial<stipendiqOtlichen) {
  34.             System.out.printf("You get a scholarship %.0f BGN", stipendiqOtlichen);
  35.         } else if (qualified  && !qualifiedUspeh) {
  36.             System.out.printf("You get a Social scholarship %.0f BGN", stipendiqSocial);
  37.         } else if (!qualified && qualifiedUspeh) {
  38.             System.out.printf("You get a scholarship %.0f BGN", stipendiqOtlichen);
  39.         }
  40.  
  41.         }
  42.  
  43.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement