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