Advertisement
Guest User

edited

a guest
Feb 17th, 2020
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.27 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.         double  income               = Double.parseDouble (scanner.nextLine ());
  7.         double  grade                = Double.parseDouble (scanner.nextLine ());
  8.         double  minWage              = Double.parseDouble (scanner.nextLine ());
  9.         double  socialScholarship    = 0;
  10.         double  excellentScholarship = 0;
  11.         boolean getScholarship       = false;
  12.  
  13.         if (income < minWage && grade > 4.50) {
  14.             socialScholarship = Math.floor (minWage * 0.35);
  15.             getScholarship = true;
  16.         }
  17.         if (grade >= 5.50) {
  18.             excellentScholarship = Math.floor (grade * 25);
  19.             getScholarship = true;
  20.         }
  21.         if (getScholarship) {
  22.             if (excellentScholarship > socialScholarship) {
  23.                 System.out.printf ("You get a scholarship for excellent results %.0f BGN", excellentScholarship);
  24.             }
  25.             else
  26.                 System.out.printf ("You get a Social scholarship %.0f BGN", socialScholarship);
  27.         }
  28.         else {
  29.             System.out.println("You cannot get a scholarship!");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement