Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class GodzillaVsKong_06 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner (System.in);
- double income = Double.parseDouble(scanner.nextLine());
- double grade = Double.parseDouble(scanner.nextLine());
- double salary = Double.parseDouble(scanner.nextLine());
- double social = 0.35 * salary;
- double excellent = 25 * grade;
- //1. <= 4.5 -> no scholarship
- //2. 4.5 и 5.5
- //3. >= 5.50
- if(grade <= 4.50){
- System.out.println("You cannot get a scholarship!");
- }else if (grade > 4.5 && grade < 5.5){
- //Social
- if(income < salary){
- System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(social));
- } else {
- System.out.println("You cannot get a scholarship!");
- }
- }else if (grade >= 5.50){
- //Excellent -> >= 5.50
- //Social -> >= 4.50 и доход < заплата
- if (income < salary){
- //годни за двете стипендии
- if(social > excellent){
- System.out.printf("You get a Social scholarship %.0f BGN", Math.floor(social));
- } else {
- System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(excellent));
- }
- } else {
- System.out.printf("You get a scholarship for excellent results %.0f BGN", Math.floor(excellent));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement