1
23
24
25
26
27
28
29
30
31
32
33
// {...}
public class Main {
public static void main(String[] args) {
double price = 100;
PaymentStrategy paymentStrategy = new CashPaymentStrategy();
System.out.println("Cash Price: - " + paymentStrategy.pay(price));
paymentStrategy = new CreditCardStrategy();
System.out.println("Credit Card Price: - " + paymentStrategy.pay(price));
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX