Advertisement
damesova

Scholarship - Java

Nov 17th, 2018
324
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. package ConditionalStatementsExcercises;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class Scholarship {
  6. public static void main(String[] args) {
  7. Scanner scanner = new Scanner(System.in);
  8.  
  9. double income = Double.parseDouble(scanner.nextLine());
  10. double midGrade = Double.parseDouble(scanner.nextLine());
  11. double minSalary = Double.parseDouble(scanner.nextLine());
  12.  
  13. double scholarshipByGrade = 0;
  14. double scholarshipSocial = 0;
  15.  
  16. if (minSalary > income) {
  17. if (midGrade > 4.5) {
  18. scholarshipSocial = minSalary * 0.35;
  19. }
  20. }
  21.  
  22. if (midGrade >= 5.5) {
  23. scholarshipByGrade = midGrade*25;
  24. }
  25.  
  26. if (scholarshipSocial > scholarshipByGrade) {
  27. System.out.printf("You get a Social scholarship %.0f BGN",
  28. Math.floor(scholarshipSocial));
  29. } else if (scholarshipSocial < scholarshipByGrade) {
  30. System.out.printf("You get a scholarship for excellent results %.0f BGN",
  31. Math.floor(scholarshipByGrade));
  32. } else {
  33. System.out.println("You cannot get a scholarship!");
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement