Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javaapp;
- import java.text.DecimalFormat;
- 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 avgresults = Double.parseDouble(scanner.nextLine());
- double minsalary = Double.parseDouble(scanner.nextLine());
- double soc=0.35*minsalary;
- double floorsoc=Math.floor(soc);
- double excellent=avgresults*25;
- double floorexcellent=Math.floor(excellent);
- DecimalFormat format = new DecimalFormat("0.#");
- if (((income>minsalary)&&(avgresults<5.50))||((income<minsalary)&&(avgresults<4.50))) {
- System.out.println("You cannot get a scholarship!");
- } else if (((avgresults>=5.50)&&(soc>excellent)&&(income<minsalary))||((avgresults>4.50)&&(avgresults<5.50)&&
- (income<minsalary))) {
- System.out.printf("You get a Social scholarship %s BGN",format.format(floorsoc));
- } else if ((avgresults>=5.50)&&(excellent>=soc)) {
- System.out.printf("You get a scholarship for excellent results %s BGN",format.format(floorexcellent));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement