SophiYo

ScholarshipSophies

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