- enum PaymentStatus {
- UNPAID, PARTPAID, PAID, DISPUTED, UNKNOWN;
- }
- public class Main {
- PaymentStatus paymentStatus = PaymentStatus.PARTPAID;
- // Switch statement
- switch (paymentStatus) {
- case UNPAID:
- message = "The order has not been paid yet. Please make the minimum/full amount to proceed.";
- break;
- case PARTPAID:
- message = "The order is partially paid. Some features will not be available. Please check the brochure for details.";
- break;
- case PAID:
- message = "The order is fully paid. Please choose the desired items from the menu.";
- break;
- default:
- }
- // Switch expression
- message = switch (paymentStatus) {
- case UNPAID -> "The order has not been paid yet.";
- case PARTPAID -> "The order is partially paid. Some features will not be available. Please check the brochure for details.";
- case PAID -> "The order is fully paid. Please choose the desired items from the menu.";
- };
- }
- }