Advertisement
todor_boichev

Untitled

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