Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Scholarship2 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double income = Double.parseDouble(scanner.nextLine());
- double averageSuccess = Double.parseDouble(scanner.nextLine());
- double minSalary = Double.parseDouble(scanner.nextLine());
- double socialScholarship = minSalary * 0.35;
- double successScholarship = averageSuccess * 25;
- String output;
- if (averageSuccess <= 4.5) {
- output = "You cannot get a scholarship!";
- } else if (averageSuccess < 5.5) {
- if (income < minSalary) {
- output = String.format("You get a Social scholarship %.0f BGN",
- Math.floor(socialScholarship));
- } else {
- output = "You cannot get a scholarship!";
- }
- } else {
- if ((income < minSalary) && (socialScholarship > successScholarship)) {
- output = String.format("You get a Social scholarship %.0f BGN",
- Math.floor(socialScholarship));
- } else if ((income < minSalary) && (successScholarship >= socialScholarship)) {
- output = String.format("You get a scholarship for excellent results %.0f BGN",
- Math.floor(successScholarship));
- } else {
- output = String.format("You get a scholarship for excellent results %.0f BGN",
- Math.floor(successScholarship));
- }
- }
- System.out.println(output);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement