EDIT***** I figured it out. I will post the solution in a bit... I could use some...

80.2K

Verified Solution

Question

Programming

EDIT*****

I figured it out. I will post the solution in a bit...

I could use some help with the following problem that implementsthe Abstract Factory Pattern:

Consider 2 SALES RECEIPT classes: RECEIPT1 and RECEIPT2.

RECEIPT1 has a method that displays the message “Receipt Body1”.

RECEIPT2 has a method that displays the message “Receipt Body2”. A SALES RECEIPT object has exactly 1 header and 1 footer.

There are 2 possible HEADER classes (HEADER1 and HEADER2) and 2possible FOOTER classes (FOOTER1 and FOOTER2). HEADER1 class has amethod that displays the message “Header 1”. HEADER2 class has amethod that displays the message “Header 2”. FOOTER1 class has amethod that displays the message “Footer 1”. FOOTER2 class has amethod that displays the message “Footer 2”. HEADER1 should be usedwith RECEIPT1 and FOOTER1. HEADER2 should be used with RECEIPT2 andFOOTER2.

You must use the abstract factory pattern tocreate sales receipts.

1) Draw the UML class diagram.

2) Provide the implementation code of the UML class diagramgiven in question 1 in Java. The object created by the client codeshould display the following message: ”Header 1 Receipt Body 1Footer 1”.

Answer & Explanation Solved by verified expert
4.2 Ratings (741 Votes)
1Required UML class diagram is given here2Required implementation code is as followspackage RECEIPTimport javautilScannerpublic class Footer1 public void f1bodySystemoutprintFooter 1 public class    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students