Advertisement
Deiancom

Scholarship

Jun 13th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. package com.company;
  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.         double incomeInLeva = Double.parseDouble(scanner.nextLine());
  9.         double grades = Double.parseDouble(scanner.nextLine());
  10.         double minSalary = Double.parseDouble(scanner.nextLine());
  11.         double socialScholarship = Math.floor(0.35 * minSalary);
  12.         double excellentScholarship = Math.floor(grades * 25);
  13.         boolean socialHave = false;
  14.         boolean excellentHave = false;
  15.  
  16.  
  17.         if (incomeInLeva < minSalary && grades > 4.50) {
  18.             socialHave = true;
  19.         }
  20.         if (grades >= 5.50) {
  21.             excellentHave = true;
  22.         }
  23.         if (socialHave  && excellentHave ) {
  24.             if (socialScholarship >= excellentScholarship) {
  25.                 System.out.printf("You get a Social scholarship %.0f BGN", socialScholarship);
  26.             } else {
  27.                 System.out.printf("You get a scholarship for excellent results %.0f BGN", excellentScholarship);
  28.             }
  29.         } else if (socialHave){
  30.             System.out.printf("You get a Social scholarship %.0f BGN", socialScholarship);
  31.         } else  if (excellentHave) {
  32.             System.out.printf("You get a scholarship for excellent results %.0f BGN", excellentScholarship);
  33.         } else {
  34.             System.out.println("You cannot get a scholarship!");
  35.         }
  36.  
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement