Advertisement
MasterHimself

Untitled

Oct 20th, 2017
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package javaapp;
  2.  
  3. import java.text.DecimalFormat;
  4. import java.util.Scanner;
  5.  
  6. public class Scholarship {
  7. public static void main(String[] args) {
  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 floorsoc=Math.floor(soc);
  16. double excellent=avgresults*25;
  17. double floorexcellent=Math.floor(excellent);
  18.  
  19. DecimalFormat format = new DecimalFormat("0.#");
  20.  
  21. if (((income>minsalary)&&(avgresults<5.50))||((income<minsalary)&&(avgresults<4.50))) {
  22. System.out.println("You cannot get a scholarship!");
  23.  
  24. } else if (((avgresults>=5.50)&&(soc>excellent)&&(income<minsalary))||((avgresults>4.50)&&(avgresults<5.50)&&
  25. (income<minsalary))) {
  26. System.out.printf("You get a Social scholarship %s BGN",format.format(floorsoc));
  27.  
  28. } else if ((avgresults>=5.50)&&(excellent>=soc)) {
  29. System.out.printf("You get a scholarship for excellent results %s BGN",format.format(floorexcellent));
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement