Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Scholarship3 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- double dohod =Double.parseDouble(scan.nextLine());
- double uspeh=Double.parseDouble(scan.nextLine());
- double minSalary=Double.parseDouble(scan.nextLine());
- double stipendiqSocial = 0.35 * minSalary;
- double stipendiqOtlichen = uspeh * 25;
- boolean qualified = false;
- boolean qualifiedUspeh = false;
- if (dohod < minSalary && uspeh > 4.50) {
- qualified = true;
- } else {
- qualified = false;
- }
- if (uspeh >= 5.50) {
- qualifiedUspeh = true;
- } else {
- qualifiedUspeh = false;
- }
- if (!(qualified == qualifiedUspeh)) {
- System.out.println("You cannot get a scholarship!");
- } else if (qualified == qualifiedUspeh && stipendiqSocial>stipendiqOtlichen) {
- System.out.printf("You get a Social scholarship %.0f BGN", stipendiqSocial);
- } else if (qualified == qualifiedUspeh && stipendiqSocial<stipendiqOtlichen) {
- System.out.printf("You get a scholarship %.0f BGN", stipendiqOtlichen);
- } else if (qualified && !qualifiedUspeh) {
- System.out.printf("You get a Social scholarship %.0f BGN", stipendiqSocial);
- } else if (!qualified && qualifiedUspeh) {
- System.out.printf("You get a scholarship %.0f BGN", stipendiqOtlichen);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement