Advertisement
Edzhevit

Scholarship

Sep 23rd, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. package OldExams;
  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. double incomeBGN = Double.parseDouble(scanner.nextLine());
  9. double averageGrade = Double.parseDouble(scanner.nextLine());
  10. double minWage = Double.parseDouble(scanner.nextLine());
  11. double success = 0.0;
  12. double scholarship = 0.0;
  13.  
  14. if (incomeBGN < minWage){
  15. if (averageGrade >= 5.50){
  16. scholarship = averageGrade * 25;
  17. success = minWage * 0.35;
  18. }else if(averageGrade >= 4.50) {
  19. success = minWage * 0.35;
  20. }
  21. }else {
  22. if (averageGrade >= 5.50){
  23. scholarship = averageGrade * 25;
  24. }
  25. }
  26. if (success == 0 && scholarship == 0){
  27. System.out.println("You cannot get a scholarship!");
  28. }else if (success > scholarship){
  29. System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(success));
  30. }else {
  31. System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(scholarship));
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement