CSE3PSD Programming Assignment 2 2024
CSE3PSD Programming Assignment 2 2024
You will design, using UML diagrams, and implement, in C++, the described solution. In
lectures, we have started discussing design patterns using a computer-controlled café, Café++,
as our motivating example. In this assessment, you will combine several of these design
patterns to yield a proof-of-concept for Café++. (Note: This is assumed to be a command-line
application; you do not need to nor are you expected to create a graphical user interface for
this assessment.)
Let the following passage describe the desired functionality:
A Patron enters the café. (The Patron is the one interacting with the system, that
is, entering data at the command line. That said, it may be helpful for there to be
a Patron class in order to distinguish between/save data for multiple users…) The
Patron “talks to” the Host – a Façade that presents the user interface and
manages interaction between the Patron and the rest of the system. Once the
Patron has given their Food and Drink Orders (either, but not both, of which may
be empty) to the Host, the Host gives the Orders to the Manager – a Mediator
that facilitates communication between the Host, the FoodMaker, and the
CoffeeMaker. (At this point, the only Food items are pre-packaged and the only
Drink items are Coffees, but your design should make it possible to add different
menu items without too much trouble…) Once the FoodMaker or CoffeeMaker
has finished making something, they should tell the Manager. Once the whole
order is complete, the Manager should tell the Host. The Host then calls the
Patron’s name and “gives” them their Food and/or Drink items. This concludes
the transaction. (Any issues not specifically identified here are not mandatory.
For example, you don’t have to worry about how the Patron will pay for their
Order.)
You may assume (for now) that all Food items are pre-packaged; for your purposes, that means
there is no customization (Decorating, subclassing, etc.) required. A Food is just a candy bar, or
a bag of crisps, or whatever. You may also assume (for now) that all Drink items are Coffees. A
Coffee can be a BlackCoffee or a WhiteCoffee. Each Coffee can be modified to contain any
(positive integer) number of sugars.
Part I: Create a UML diagram describing these classes and their interactions (30 marks)
Create a UML diagram describing these classes and their interactions. You may use any tool to
create this diagram, including drawing it by hand and scanning it. (But please make it easy to
read.)
Part II: Implement in C++ code the design you created in Part I (30 marks)
Write C++ code to implement your design. Your design should follow good C++ practices you
should separate interfaces and implementations, each class should be in a separate file, and so
on.
Part III: Extend your design with at least one meaningful addition (30 marks)
For this part, you are to extend your design with at least one substantial bit of additional
functionality. You may choose from the following list, or you may propose something that is
interesting to you (but please check with your instructor first):
- Add more customization options to Coffees (at least two) – for example, enabling the
Patron to choose different types of milk in a WhiteCoffee, or enabling the Patron to
order different types of WhiteCoffee (Latte, Cappuccino, Flat White, etc.)
- Add a different hierarchy of Food or Drink – for example, perhaps now Café++ sells
Sandwiches or Tea (either of which would have their own customization options...)
- Enable the Patron to make their Order HaveHere or Takeaway.
- Make the Patron pay for their Order (this would involve adding a cost associated with
each menu item and modification, and perhaps having different Cash or Credit payment
options…)
Modify your UML diagram (15 marks) and modify your C++ code (15 marks) accordingly.
Part IV: Reflect upon and document your experience (10 marks)
Write a short document containing, at the very least, what change(s) you made in Part III and
how you did so. Other topics you might reflect on:
- Your experience with the initial design and implementation
- Your experience “extending” the initial design, in particular whether you think it was
made easier or harder by your design choices in Part I and Part II
- What aspects of this project were particularly difficult?
- What aspects of this project were particularly rewarding?
- What, if anything, did you learn from undertaking this project?
Good luck!