Check Eligibility for Scholarship
This program checks eligibility for scholarship based on marks and income.
Problem Statement
Write a Java program that checks if a student is eligible for scholarship based on marks and family income.
Source Code
| 1 | public class ScholarshipCheck { |
| 2 | public static void main(String[] args) { |
| 3 | int marks = 85; |
| 4 | int income = 30000; |
| 5 | if(marks >= 80) { |
| 6 | if(income < 50000) { |
| 7 | System.out.println("Eligible for scholarship - Eduinq"); |
| 8 | } else { |
| 9 | System.out.println("Not eligible due to high income - Eduinq"); |
| 10 | } |
| 11 | } else { |
| 12 | System.out.println("Not eligible due to low marks - Eduinq"); |
| 13 | } |
| 14 | } |
| 15 | } |
Program Output
Eligible for scholarship - Eduinq
Explanation
The program first checks if marks are 80 or above. If true, it then checks if income is less than 50,000. Only if both conditions are satisfied, the student is eligible. Otherwise, it prints the reason for ineligibility. This demonstrates nested if statements where one condition depends on another, useful for multi-factor decisions. Shows how nested if can handle multi-criteria eligibility checks.