support@homeworkmarkettutors.com

Call toll free: +1 (304) 900-6229 or Request a call

Homework is 3 parts: A, B, and C Part A:

Homework is 3 parts: A, B, and C

Part A:

A small restaurant only provides burger and sandwich. It has two chefs and one waitress. Chef A is assigned to make burger and Chef B make sandwich. Waitress’s job is to present customer’s order to the right chef. You are required to use {{{{{Command pattern}}}}} to illustrate the order process. As we discussed in lecture, in this case, the invoker is responsible for not only storing and dispatching command, but choosing appropriate receiver as well. The receiver class (chef) contains only one method MakeFood(), it will display on screen the food is being made.

1) Give the UML class diagram

2) Provide the implementation code of the UML class diagram given in JAVA.  The main application should display the following message 

“Welcome, would you like to order a burger or sandwich?”, then based on customer’s choice, store and dispatch the order to the right chef.

Note: Show in the diagram how you used Command pattern to implement the code 

—————————————————————————————————————————————–

Part B: 

A house automation system uses four devices to automate operations. The four devices are

a) A Weather instrument that provides current weather (rain, cloud, sunny, etc)

b) A CoffeePot

c) A Calendar that provides date, day, time info and a timer

d) A Sprinkler

Use{{{{{{{{{{{{{{{ Mediator pattern}}}}}}}}} to coordinate these four devices and automate the following operations

i)    During weekdays, start to make coffee at 6am

ii)   At the weekend,  if weather is sunny, start to make coffee at 7am or at 8am

iii) During June to October, start sprinkler twice a day (6am, 8pm) and run it for 15 mins. But sprinkler will not start if it is raining.

1) Give the UML class diagram

2) Provide the implementation code of the UML class diagram given in this part of question using JAVA.

Note: Show in the diagram how you used Mediator pattern to implement the code 

—————————————————————————————————————————————–

Part C: 

Use the {{{{{{{{{{Observer pattern}}}}}}}}}}}}}}}}} in a situation where registered flight ticket buyers are notified when ticket price is lower than or equal to a certain amount specified by the buyer at the registration time. For example John expects to be notified only when round trip DTW <> NYC on 12/24 <> 12/29  reaches $210.  Different buyer may have different expectation for the same flight. At registration time with a given flight each buyers provides his/her name, from city, destination city, departure date, return date and expected price.  Similarly, a flight is defined by {from city, destination city, departure date, return date and price}

1) Give the UML diagram using the observer pattern.  In the pattern, there should be one single ConcreteObserver class. Each buyer will be an instance of that class.  There should also be one single concreteSubject class. Each flight will be an instance of that class. You are requested to give the details of each class in the diagram (i.e., methods, properties, whether the methods/properties are private, public, or protected).

2) Give the implementation code of the UML diagram. You must use PULL mode to implement the notification. The PULL mode usually involves two steps, first notifies the investor the flight price reaches his expectation and then he retrieves the flight information anytime he wants in the future. In the main application, you are requested to create three flights (as instances of the concretSubject class): 

{Chi, SFO, 01/15/2022, 01/26/2022, $420}, {DTW, NYC, 02/03/2022, 02/10/2022, $240}, {FLL, DFW, 04/23/2022, 04/28/2022, $300} You are also requested to create two buyers: John and Maria. John will register with the first flight with an expectation of $350 and second flight with an expectation of $200.  Maria will register with the second flight with an expectation of $220 and third flight with an expectation of $280. Also in the main program, testing the scenarios of receiving notification.

Note: Show in the diagram how you used Observer pattern to implement the code 

Share This Post

Email
WhatsApp
Facebook
Twitter
LinkedIn
Pinterest
Reddit

Order a Similar Paper and get 15% Discount on your First Order

Related Questions