Question: . 1 TO 1 A4 Write the required Java code to implement only the two classes Bread Decorator and Cheese Decorator using the decorator pattern.
. 1 TO 1 A4 Write the required Java code to implement only the two classes Bread Decorator and Cheese Decorator using the decorator pattern. The GetCosto returns the products price. It can be the original price or global price after decoration (after adding cheese or potato). The methods AddCheese and AddPotato return the decoration's price. The GetDescription returns the description of the final product (Example: French Bread with cheese") Bread -description : String -cost : Double +GetDescription() String +GetCost(): Double French Bread +GetDescription(String +GetCost()Double Arabic Bread +GetDescription() String +GetCost(): Double BreadDecorator +GetDescription() String +GetCost(): Double Cheese Decorator +GetDescription String +GetCosto: Double AddCheese) Double PotatoDecorator +GetDescription() String +GetCosti) Double "AddPotato) Double AI 5 PS
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
