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

APA format Cite at least one reference 175 – 265

APA format Cite at least one reference 175 – 265 words Respond to the following:   Dr. Susan Jones 4/20/22, 7:51 AM Class, Another important ratio for a business (and an individual) is the Debt‐to‐Income Ratio. This ratio is helpful for showing a company has too much debt compared to

This assignment is the same for weeks 5-8 but the

  This assignment is the same for weeks 5-8 but the roles will shift through your group as different folks present. Each person will present once and each person will be the facilitator once. Note these responsibilities on the forms you turn in to the instructor. Prior to Week Five:

Conduct online search to locate current healthcare accrediting bodies. Compare

Conduct online search to locate current healthcare accrediting bodies. Compare and contrast them with The Joint Commission (TJC) with respect to Electronic Health Record requirements and communication with patients through web portals or other means. Your initial post comprising a minimum of 250 words should have 2-3 credible sources/peer reviewed

This week we have gone over Bloodborne Pathogens in the

 This week we have gone over Bloodborne Pathogens in the workplace, while the textbook focuses on HIVAIDS and AnyAll Hepatitis, there are other Bloodborne Pathogens that can affect workers especially in the health care industry. For this assignment, you are to identify another (NOT HIVAIDS or AnyAll Hepatitis) Bloodborne Pathogen,

Research Question: Why do people choose plant-based meat over animal

Research Question:  Why do people choose plant-based meat over animal meat for consumption despite the lower price of real meat? Max. length: 1 page A few paragraphs of description, including: your research question (the “puzzle”) why this is interesting some thoughts on how you plan to tackle the answer (e.g.,

Discuss Jean Piaget about what he was known for why he chose

Find 3 resources that talk about or discuss Jean Piaget about what he was known for why he chose psychology and what he was known for thru his career as a psychologist. Write one paragraph about each resource information about Piaget. Provide a reference page in apa format for each

University of Southern California Global Health Issue Paper Nursing Assignment Help

Choose a global health issue. For this assignment, you will introduce the health issue and discuss the interventions necessary to prevent the issue and promote health. Some topics to consider may include: Anthrax Bioterrorism Cholera Clostridium botulinum infection Community-associated methicillin-resistant Staphylococcus Ebola virus disease Escherichia coli Human immunodeficiency virus disease

Instructions: Read the case study: Rose is a 15-year-old girl

Instructions: Read the case study: Rose is a 15-year-old girl who resides in a small remote village in a Sub-Saharan African country. She was married at 14 because her family arranged the marriage to be relieved of the burden of providing for her. She is pregnant with her first child. A

In this first milestone, you will complete an introduction and

 In this first milestone, you will complete an introduction and provide background information on your chosen attack. The milestones in this course will allow you to draft ideas and receive feedback from the instructor throughout the course. Each milestone builds on the previous one. These assignments will ensure that you

IGLOBAL UNIVERSITY Health & Medical Question Nursing Assignment Help

Prompt: The Role of the Christian Healthcare Administrator: In this assignment you will describe the roles and responsibilities of a healthcare administrator as well as the skills and attributes necessary to become a healthcare strategist. You will assess yourself utilizing the ACHE Healthcare Executive 2022 Competencies Assessment Tool (CAT-2022) to

Both of these documentaries were extremely sad to watch. These

Both of these documentaries were extremely sad to watch. These types of abuse are racist attacks and borderline abuse of a disabled person. The second documentary talked about the albinos face trouble with their eyes so attacks like this could be difficult because they are not able to see as

You are the Lead of the Test team in your

You are the Lead of the Test team in your Department.  Your team is typically exposed to software for testing once it is developed, packaged and ready to be deployed on the web.  They ask that you test and approve it before it is deployed.  Your team usually finds errors

Grief: define and describe the physical symptoms, psychological and social

  Grief: define and describe the physical symptoms, psychological and social responses and its spiritual aspects. Summarize the types of grief. Although death is a universal human experience, please specify culture-specific considerations that exist regarding attitudes toward the loss of a loved one, including age (child or older adult) and

Use this week’s discussion to reflect on the use of

  Use this week’s discussion to reflect on the use of files and rasps by answering the following prompt.  When is it appropriate to use a file versus a stone? What are the most common types of files for use with metal? Can we use a bastard cut file on

Chapter 8: Chinese government structure beginning with Sui Dynasty- be

 Chapter 8:   Chinese government structure beginning with Sui Dynasty- be sure to know the different departments of their bureaucracy (finance, personnel, etc.), the examination system, etc.  Note that many modern governments are set up essentially the same way!  Chapter 9:   The Five Pillars of Islam- be sure to know what

As a program director, you would have the responsibility of

  As a program director, you would have the responsibility of conducting program evaluations. The Riverbend City scenario, A Day in the Life of a Human Services Leader, provides some insight into how a program director may need to conduct different types of program evaluations to meet various requests for

Read “Bartleby the Scrivener” -Explain the narrators sympathy toward

Read “Bartleby the Scrivener” Write an argumentative essay that answers the following questions: -Explain the narrators sympathy toward Bartleby. Why is he sympathetic? What does it suggest? Paper will need to have a few basic parts: 1.) Thesis -Clearly state what you are asserting about the story. -Provide a basic