Online Shopping Discount

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

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 ShoppingDiscount {
2 public static void main(String[] args) {
3 double purchase = 2000;
4 boolean member = true;
5 if(purchase >= 1500 && member) {
6 System.out.println("Discount applied - Eduinq");
7 } else {
8 System.out.println("No discount - Eduinq");
9 }
10 }
11 }

Program Output

Discount applied - Eduinq

Explanation

The program checks two conditions: purchase amount must be at least 1500 and customer must be a member. Both conditions must be true for discount eligibility. If either fails, no discount is applied. This demonstrates how multiple conditions can be combined to implement real-world retail rules, ensuring that discounts are applied only to loyal customers with sufficient purchases. Shows how shopping discounts can be implemented using multiple conditions.

Quick Links to Explore