Advertisement
Guest User

Untitled

a guest
May 25th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 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.  
  7. double dohod = Double.parseDouble(scanner.nextLine());
  8. double avUspeh = Double.parseDouble(scanner.nextLine());
  9. double minSalary = Double.parseDouble(scanner.nextLine());
  10. double uspehScholarship = Math.floor(avUspeh * 25);
  11. double socialScholarship = Math.floor(minSalary * 0.35);
  12.  
  13. if (avUspeh < 4.5) {
  14. if (dohod > minSalary) {
  15. System.out.println("You cannot get a scholarship!");
  16. } else if (dohod <= minSalary) {
  17. System.out.println("You cannot get a scholarship!");
  18. }
  19. } else if (avUspeh >= 4.5 && avUspeh < 5.5) {
  20. if (dohod > minSalary) {
  21. System.out.println("You cannot get a scholarship!");
  22. } else if (dohod <= minSalary) {
  23. System.out.printf("You get a Social scholarship %.0f BGN",socialScholarship);
  24. }
  25. }
  26. if (avUspeh >= 5.5) {
  27. double maxScholarship = Math.max(uspehScholarship, socialScholarship);
  28. if (maxScholarship == socialScholarship) {
  29. System.out.printf("You get a Social scholarship %.0f BGN",socialScholarship);
  30. } else if (maxScholarship == uspehScholarship) {
  31. System.out.printf("You get a scholarship for excellent results %.0f BGN", uspehScholarship);
  32.  
  33.  
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement