Advertisement
Guest User

scholarship

a guest
Jan 21st, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.62 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         double income = scanner.nextDouble();
  10.         double gpa = scanner.nextDouble();
  11.         double minIncome = scanner.nextDouble();
  12.  
  13.         double excellentGrade = 5.5;
  14.         double socialGrade = 4.5;
  15.         double socialScholarship = Math.floor(minIncome * 0.35);
  16.         double excellentScholarship = Math.floor(gpa * 25);
  17.  
  18. //        System.out.println("You get a Social scholarship " + String.format("%.0f",socialScholarship) + " BGN");
  19. //        System.out.println("You get a scholarship for excellent results " + String.format("%.0f",excellentScholarship) + " BGN");
  20. //        System.out.println("You cannot get a scholarship!");
  21.  
  22.  
  23.         if(gpa >= 5.5) {
  24.             if(income <= minIncome && socialScholarship > excellentScholarship) {
  25.                 System.out.println("You get a Social scholarship " + String.format("%.0f",socialScholarship) + " BGN");
  26.             }else {
  27.                 System.out.println("You get a scholarship for excellent results " + String.format("%.0f",excellentScholarship) + " BGN");
  28.             }
  29.         }else if(gpa >= 4.5 && gpa < 5.5) {
  30.             if(income <= minIncome) {
  31.                 System.out.println("You get a Social scholarship " + String.format("%.0f",socialScholarship) + " BGN");
  32.             }else {
  33.                 System.out.println("You cannot get a scholarship!");
  34.             }
  35.         }else {
  36.             System.out.println("You cannot get a scholarship!");
  37.         }
  38.  
  39.         scanner.close();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement