Advertisement
Angel_Kalinkov

PBE-03September2017-Scholarship_AngelKalinkov

Mar 24th, 2018
115
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 Scholarship2 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double income = Double.parseDouble(scanner.nextLine());
  8.         double averageSuccess = Double.parseDouble(scanner.nextLine());
  9.         double minSalary = Double.parseDouble(scanner.nextLine());
  10.  
  11.         double socialScholarship = minSalary * 0.35;
  12.         double successScholarship = averageSuccess * 25;
  13.         String output;
  14.  
  15.         if (averageSuccess <= 4.5) {
  16.             output = "You cannot get a scholarship!";
  17.         } else if (averageSuccess < 5.5) {
  18.             if (income < minSalary) {
  19.                 output = String.format("You get a Social scholarship %.0f BGN",
  20.                         Math.floor(socialScholarship));
  21.             } else {
  22.                 output = "You cannot get a scholarship!";
  23.             }
  24.         } else {
  25.             if ((income < minSalary) && (socialScholarship > successScholarship)) {
  26.                 output = String.format("You get a Social scholarship %.0f BGN",
  27.                         Math.floor(socialScholarship));
  28.             } else if ((income < minSalary) && (successScholarship >= socialScholarship)) {
  29.                 output = String.format("You get a scholarship for excellent results %.0f BGN",
  30.                         Math.floor(successScholarship));
  31.             } else {
  32.                 output = String.format("You get a scholarship for excellent results %.0f BGN",
  33.                         Math.floor(successScholarship));
  34.             }
  35.         }
  36.         System.out.println(output);
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement