Question: Exercise 6 - Making Ice Cream with Decorators For this exercise, use Decorators to create an ice cream sundae with Brownie, Banana, Chocolate Syrup, Nuts,

 Exercise 6 - Making Ice Cream with Decorators For this exercise,

Exercise 6 - Making Ice Cream with Decorators For this exercise, use Decorators to create an ice cream sundae with Brownie, Banana, Chocolate Syrup, Nuts, and a Cherry. You've been provided with a function called addiceCream - DO NOT make any changes to the parameters or body of this function! DO NOT make any changes to the call of this function. You must complete this task without changing either of these two elements. You'll need to add Decorators to this function to make this work! You've also been given 5 ingredients that you must add to the ice cream using Decorators. Convert each of the other functions into Decorators and then Decorate the addiceCream function to extend its functionality. Hint: get just ONE of these working before you make a bunch of sweeping changes! Think carefully about the ordering of the function call within the wrapper as you create your Decorator - should each decorator go BEFORE or AFTER the function call?! Rules for making ice cream sundaes: Brownies go on the bottom Bananas go on top of Brownies Ice cream is on top of the Bananas Chocolate Syrup goes on top of the Ice cream Nuts go on top of Chocolate Syrup The Cherry goes on top of the nuts For example, your output should be as follows: Adding Brownie Adding Banana Adding Ice Cream Adding Chocolate Syrup Adding Nuts Adding the Cherry on Top! Exercise 6 - Making Ice Cream with Decorators For this exercise, use Decorators to create an ice cream sundae with Brownie, Banana, Chocolate Syrup, Nuts, and a Cherry. You've been provided with a function called addiceCream - DO NOT make any changes to the parameters or body of this function! DO NOT make any changes to the call of this function. You must complete this task without changing either of these two elements. You'll need to add Decorators to this function to make this work! You've also been given 5 ingredients that you must add to the ice cream using Decorators. Convert each of the other functions into Decorators and then Decorate the addiceCream function to extend its functionality. Hint: get just ONE of these working before you make a bunch of sweeping changes! Think carefully about the ordering of the function call within the wrapper as you create your Decorator - should each decorator go BEFORE or AFTER the function call?! Rules for making ice cream sundaes: Brownies go on the bottom Bananas go on top of Brownies Ice cream is on top of the Bananas Chocolate Syrup goes on top of the Ice cream Nuts go on top of Chocolate Syrup The Cherry goes on top of the nuts For example, your output should be as follows: Adding Brownie Adding Banana Adding Ice Cream Adding Chocolate Syrup Adding Nuts Adding the Cherry on Top

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!