Strategy Design pattern in java
A design pattern that selects the algorithm’s behavior dynamically. Basically,this is a behavioral design pattern. It follows the runtime instruction to choose the algorithm. So it is more flexible. How to implement the strategy design pattern? It includes the three major components. Strategy Interface: It is the basic for all implementation. Concrete Strategies: It implements the interface with specific functionality. Context class: this is thee one which allows the strategy to choose at runtime. A shopping Application is developed here. Strategy interface: PayBillStrategy CreditCardPay ,PayPalPay : concrete strategy Billpay() is used to pay the bill. It is overridden for two strategy. Context class: Shopping Cart setPayBillStrategy() : Select the strategy at runtime. Checkout() : used to send cart to bill payment. Shop App : It is the class with main function. It creates the objects and call the contex...