Check Insurance Eligibility

This program checks insurance eligibility based on age, health status, and income.

Problem Statement

Write a Java program that checks if a person is eligible for insurance based on age, health status, and income.

Source Code

1 public class InsuranceEligibility {
2 public static void main(String[] args) {
3 int age = 30;
4 boolean healthy = true;
5 double income = 40000;
6 if(age >= 25 && age <= 60 && healthy && income >= 30000) {
7 System.out.println("Eligible for insurance - Eduinq");
8 } else {
9 System.out.println("Not eligible for insurance - Eduinq");
10 }
11 }
12 }

Program Output

Eligible for insurance - Eduinq

Explanation

The program checks four conditions: age must be between 25 and 60, health status must be true, and income must be at least 30,000. All conditions must be true for eligibility, so the program uses logical AND. If any condition fails, the else block prints not eligible. This demonstrates how multiple conditions can be combined to make decisions based on several factors, common in insurance eligibility checks. Shows how multiple conditions determine insurance eligibility.

Quick Links to Explore