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

https://www.youtube.com/watch?v=eWIV3wWygS4 https://files.eric.ed.gov/fulltext/ED594465.pdf What issues do children living in poverty face

https://files.eric.ed.gov/fulltext/ED594465.pdf  What issues do children living in poverty face that negatively impacts their education? What impact does trauma have on children and learning? How can the education system help mediate these? What was new or interesting, make a connection, raise a question.   https://ed100.org/lessons/specialneeds  What are the key laws relating to

Create a study guide for the E&M codes. It might help to use either bullet items or in a table format. Post your study guide for your initial post. For your follow up posts, POLITELY critique two Nursing Assignment Help

Create a study guide for the E&M codes. It might help to use either bullet items or in a table format. Post your study guide for your initial post. For your follow up posts, POLITELY critique two of your classmates’ guides. Are they missing anything? Is there something unclear? Remember these tools might not

Using Social Media in Health Care

 Description Objective: Identify the use of social networking in health care Assignment Overview:this assignment will discuss the use of social networking in health care. Deliverables: A two-page paper and Link to social media page Conduct research:Using your textbook, the Internet, or other reputable resources, explore various disorders and diseases. Textbook

Choose one of the research areas under the Trends in

  Choose one of the research areas under the Trends in Requirements Management in Chapter One of the Wiley Guide to Project Technology, Supply Chain and Procurement Management. Those trends include: Data Processing and Modeling Increasing Formality Viewpoints Goal-oriented requirement elicitation Nonbehavioral requirements Scenarios In this paper, provide the reader

Afterlife Beliefs-Ancient Rome/Greece

Description * 12 point font *8 pages long * Title Page * pages numbered * footnotes not endnotes * bibliography at the end. * SOURCES: Three scholarly secondary sources in book form, two scholarly articles, as many ancient sources as possible. Chicago style. (I put 10 in the order, the

Questions you need to ANSWER: After reading this weeks tasks,

Questions you need to ANSWER: After reading this weeks tasks, how do you market your product/services? How do you decide what price to set your product/services? Provide strategies that shows your pricing strategies.  ______________ APA:  – Do not forget to cite all borrowed thoughts – Provide at least 1 external

Examine why is it important to identify stakeholders and the

  Examine why is it important to identify stakeholders and the project team early on when undertaking a project. Identifying and engaging the stakeholder’s influence in the decision-making process from the initial phase of any project is crucial for support and resource; they can be an effective participant sharing various

A summary of the benefits of high-quality programs for young

A summary of the benefits of high-quality programs for young children and their families At least three research-based components that contribute to quality programming Why access to affordable high-quality care can be such a challenge for so many families Your personal definition of quality as it relates to early childhood

1.Distinguish the programming approach used in procedural programming and object-oriented

1.Distinguish the programming approach used in procedural programming  and object-oriented programming.  2.Discuss the validity of the following statement: The object-oriented  programming approach is ideal for simulating real-world problems.  3.Consider the following scenarios and outline the objects and their  interactions in terms of messages and arguments: a.a driver driving a car; 

viginia hendersons needs theory

Description This assignment complete the analysis of a theory by evaluating it’s usefulness in practice. Instructions: Using Virginia Henderson’s Needs theory complete an evaluation using the questions below as subheadings. Use narrative writing, follow APA writing guidelines, and include acknowledgement of sources. You must have a title page and reference

Positive Leadership can help an organization overcome obstacles such as

Positive Leadership can help an organization overcome obstacles such as a hostile work environment.  Positive Leadership can also foster an effective organizational culture enhanced by diversity and gender differences.    Please refer to Chapters 1-5 in The Power of Positive Leadership. Positive Leadership Concept Questions: Answer the following questions:  How

Barbara, Good start to the discussion. Since you are correlating

  Barbara,  Good start to the discussion.  Since you are correlating two variables (beliefs and feelings) you’ll need a separate scale to measure each.  If you take from the same scale, likely the variables are already correlated as that is part of scale development and then you would lose the

Problems related to Price setting, Chapter 18 is attached. Here

Problems related to Price setting, Chapter 18  is attached.  Here is the guidance for preparation before solving the problems in the attached.  1.  Review and study Chapter 18 text. especially the topics on Cost based pricing and Break-even analysis 2. Watch the Video ppt recording for chapter 18 under Course

For this third milestone, you will reflect on content that

For this third milestone, you will reflect on content that will inform your multimedia presentation, which you will include in Final Project Part Two. You will reflect on the intersectional nature of diversity and its impact on one’s individual framework of perception, one’s discipline of study, and society in general.

Malicious software attacks are a common concern for IT security

Malicious software attacks are a common concern for IT security professionals. Even with the growth in the use of IT security and antivirus software, these attacks continue. Why do you feel that this is a constant threat? Are there actions that IT security professionals can undertake to reduce or eliminate

Topic 2 DQ 2 The biggest issue writer’s organization in

 Topic 2 DQ 2 The biggest issue writer’s organization in addressing a solution to evidence-based nursing practice is nurse shortage. The nurse turnover rate is higher in this organization than in any other neighborhood hospital. The department of education is providing classes for all employees promptly however the employees are