Check Discount Eligibility

This program checks discount eligibility based on purchase amount and membership status.

Problem Statement

Write a Java program that checks if a customer is eligible for discount based on purchase amount and membership status.

Source Code

1 public class DiscountEligibility {
2 public static void main(String[] args) {
3 double purchase = 1500;
4 boolean isMember = true;
5 if(purchase >= 1000 && isMember) {
6 System.out.println("Eligible for discount - Eduinq");
7 } else {
8 System.out.println("Not eligible for discount - Eduinq");
9 }
10 }
11 }

Program Output

Eligible for discount - Eduinq

Explanation

The program checks two conditions: purchase amount must be at least 1000 and the customer must be a member. - Both conditions must be true for eligibility, so the program uses logical AND. - If either condition fails, the else block prints not eligible. - This demonstrates how multiple conditions can be combined to make decisions based on more than one factor, common in retail and loyalty programs. Conclusion: Shows how multiple conditions determine discount eligibility.

Quick Links to Explore