Groney

Scholarship

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