Advertisement
Guest User

Untitled

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