{br} STUCK with your assignment? {br} When is it due? {br} Get FREE assistance. Page Title: {title}{br} Page URL: {url}
+1 917 8105386 [email protected]

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

Our customer support team is here to answer your questions. Ask us anything!
WeCreativez WhatsApp Support
Support Supervisor
Brian
Available