Scenario: A company wants to check if a customer is eligible for a discount based on age.
Use Case: If the customer’s age is above 60, show “Senior Discount Applicable”.
Apex Program:

Explanation:
public class DiscountChecker {- Creating a class named
DiscountChecker - Real-world use: This class can be used in a retail or healthcare system
- Creating a class named
public static void checkDiscount(Integer age) {- Method that takes customer
ageas input Integer age– age value passed when method is called
- Method that takes customer
if(age >= 60) {- Checking if the customer is 60 or older
- Condition to verify senior citizen eligibility
System.debug('Senior Discount Applicable');- Logs message if condition is true
- Could be extended later to apply discount on billing
} else {- If condition fails (i.e., age < 60), then this block runs
System.debug('No Discount Available');- Message when customer is not eligible
}– method and class close
Sample Calls + Output:

Real-Life Usage:
- Can be used in Billing System of:
- Medical stores
- Movie ticket booking
- Online shopping for seniors

Visit: https://sfdctelugu.in/courses/






















