4) Give the UML class diagram.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
The same description as Problem I. You are asked to display order's item list and meal cost to
customer. Each meal must have at least one main item, but side item and drink are optional. Also,
a 10% coupon code is available to use. So the main items can be decorated by the side items,
drink and coupon. This gives a customer flexibility to order any number of sides or drinks for a
meal. Please note that each side item and drink can be multiple or partial. The cost of multiple or
partial side and drink is adjusted proportionally, for example, cost of 2 orders of Coke is 2x$1.00,
40% order of Fries is 0.4x$1.5. However, coupon can be used only once per order.
We would like to use the Decorator pattern and Singleton pattern to create the receipt to
show order's item name, quantity, item unit price, item cost, any coupon applied and final cost.
The singleton is to ensure that the coupon can be applied only once in an order.
Here is price for each item
Main items, Hamburger: $6.5; Cheeseburger: $5.0; Double Cheeseburger: $7.00
Side items, Fries: $1.5; Onion Ring, $1.3
Drink: Coke: $1.00; Sprite: $1.20
4) Give the UML class diagram.
5) Provide the implementation code of the UML class diagram given in question 4) in the
programming language of your choice. In the client code, create an order that consists of
1 Hamburger, 1 cheeseburger with 40% fries, 60% Onion Ring and double coke and
applying the coupon code "10%Off". The client code should display order items, item
quantity, item unit price, item cost, coupon, and final cost.
6) Provide screenshot of the program running result.
7) Now for the similar problem description, you have used two different patterns to
implement. Please state the difference of the builder and decorator pattern in your
implementation.
Transcribed Image Text:The same description as Problem I. You are asked to display order's item list and meal cost to customer. Each meal must have at least one main item, but side item and drink are optional. Also, a 10% coupon code is available to use. So the main items can be decorated by the side items, drink and coupon. This gives a customer flexibility to order any number of sides or drinks for a meal. Please note that each side item and drink can be multiple or partial. The cost of multiple or partial side and drink is adjusted proportionally, for example, cost of 2 orders of Coke is 2x$1.00, 40% order of Fries is 0.4x$1.5. However, coupon can be used only once per order. We would like to use the Decorator pattern and Singleton pattern to create the receipt to show order's item name, quantity, item unit price, item cost, any coupon applied and final cost. The singleton is to ensure that the coupon can be applied only once in an order. Here is price for each item Main items, Hamburger: $6.5; Cheeseburger: $5.0; Double Cheeseburger: $7.00 Side items, Fries: $1.5; Onion Ring, $1.3 Drink: Coke: $1.00; Sprite: $1.20 4) Give the UML class diagram. 5) Provide the implementation code of the UML class diagram given in question 4) in the programming language of your choice. In the client code, create an order that consists of 1 Hamburger, 1 cheeseburger with 40% fries, 60% Onion Ring and double coke and applying the coupon code "10%Off". The client code should display order items, item quantity, item unit price, item cost, coupon, and final cost. 6) Provide screenshot of the program running result. 7) Now for the similar problem description, you have used two different patterns to implement. Please state the difference of the builder and decorator pattern in your implementation.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY