Design Patterns, Behavioural Design, Java, Software Development.
main(String[] args) { // Create a shopping cart ShoppingCart cart = new ShoppingCart(); // Set payment strategy to credit card cart.setPaymentStrategy(new CreditCardPaymentStrategy("1234567890123456", "12/23", "123")); // Checkout using the selected payment strategy cart.checkout(100.00); // Change