Advertisement
svephoto

Scholarship [Java]

Jul 25th, 2020
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.32 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Scholarship {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6. //Доход в лева - реално число в интервала [0.00..6000.00]
  7. //2. Среден успех - реално число в интервала [2.00...6.00]
  8. //3. Минимална работна заплата - реално число в интервала
  9.         double incomeLeva = Double.parseDouble(scanner.nextLine());
  10.         double averageGrade = Double.parseDouble(scanner.nextLine());
  11.         double minimalIncome = Double.parseDouble(scanner.nextLine());
  12.  
  13.         double input1 = Math.floor(minimalIncome * 0.35);
  14.         double input2 = Math.floor(averageGrade * 25);
  15.  
  16.         if (averageGrade >= 5.5) {
  17.             if (input2 >= input1 || incomeLeva > minimalIncome) {
  18.                 System.out.printf("You get a scholarship for excellent results %.0f BGN", input2);
  19.             } else {
  20.                 System.out.printf("You get a Social scholarship %.0f BGN", input1);
  21.             }
  22.         } else if (incomeLeva < minimalIncome && averageGrade > 4.5) {
  23.             System.out.printf("You get a Social scholarship %.0f BGN", input1);
  24.         } else {
  25.             System.out.println("You cannot get a scholarship!");
  26.         }
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement