Advertisement
mirozspace

B

Apr 2nd, 2019
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class pr7Scholarships {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double incomeLeva = Double.parseDouble(scanner.nextLine());
  8.         double averageSuccess = Double.parseDouble(scanner.nextLine());
  9.         double salaryLeva = Double.parseDouble(scanner.nextLine());
  10.         double socialPension = 0;
  11.         double cholarships = 0;
  12.  
  13.         if (incomeLeva < salaryLeva && averageSuccess > 4.5) {
  14.             socialPension = salaryLeva * 0.35;
  15.         }
  16.  
  17.         if (averageSuccess >= 5.5) {
  18.             cholarships = averageSuccess * 25;
  19.         }
  20.  
  21.         //if (averageSuccess < 4.5 && incomeLeva >= salaryLeva) {
  22.         if (socialPension == 0 && cholarships == 0) {
  23.             System.out.println("You cannot get a scholarship!");
  24.         } else if (socialPension >= cholarships) {
  25.             socialPension = Math.floor(socialPension);
  26.             System.out.printf("You get a Social scholarship %.0f BGN", socialPension);
  27.         } else if (cholarships > socialPension) {
  28.             cholarships = Math.floor(cholarships);
  29.             System.out.printf("You get a scholarship for excellent results %.0f BGN", cholarships);
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement