Advertisement
Guest User

Untitled

a guest
Sep 21st, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.43 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class exercise5 {
  3.     public static void main(String[] args) {
  4.         Scanner in = new Scanner(System.in);
  5.         double income = Double.parseDouble(in.nextLine());
  6.         double grades = Double.parseDouble(in.nextLine());
  7.         double minimal = Double.parseDouble(in.nextLine());
  8.        
  9.         double socialSholar = minimal * 0.35;
  10.         double gradeScolar = grades * 25;
  11.  
  12.         boolean canTakeExcellent = false;
  13.         boolean canTakeSocial = false;
  14.  
  15.         if(income < minimal && grades > 4.5) {
  16.             canTakeSocial = true;
  17.         }
  18.         if(grades >= 5.5) {
  19.             canTakeExcellent = true;
  20.         }
  21.  
  22.         if(canTakeSocial == true && canTakeExcellent == true) {
  23.             if(socialSholar >= gradeScolar) {
  24.                 System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(socialSholar));
  25.             } else {
  26.                 System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(gradeScolar));
  27.             }
  28.         } else if (canTakeSocial == true) {
  29.             System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(socialSholar));
  30.         } else if (canTakeExcellent == true) {
  31.             System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(gradeScolar));
  32.         } else {
  33.             System.out.println("You cannot get a scholarship!");
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement