Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class Scholarship {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double incomeInLeva = Double.parseDouble(scanner.nextLine());
- double grades = Double.parseDouble(scanner.nextLine());
- double minSalary = Double.parseDouble(scanner.nextLine());
- double socialScholarship = Math.floor(0.35 * minSalary);
- double excellentScholarship = Math.floor(grades * 25);
- boolean socialHave = false;
- boolean excellentHave = false;
- if (incomeInLeva < minSalary && grades > 4.50) {
- socialHave = true;
- }
- if (grades >= 5.50) {
- excellentHave = true;
- }
- if (socialHave && excellentHave ) {
- if (socialScholarship >= excellentScholarship) {
- System.out.printf("You get a Social scholarship %.0f BGN", socialScholarship);
- } else {
- System.out.printf("You get a scholarship for excellent results %.0f BGN", excellentScholarship);
- }
- } else if (socialHave){
- System.out.printf("You get a Social scholarship %.0f BGN", socialScholarship);
- } else if (excellentHave) {
- System.out.printf("You get a scholarship for excellent results %.0f BGN", excellentScholarship);
- } else {
- System.out.println("You cannot get a scholarship!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement