A Java Swing GUI application demonstrating five design patterns: Builder, Observer, Strategy, State, Decorator.
IMPORTANT: every class is prefixed with the placeholder student ID
K2533109. Before submitting, do a global find-and-replace ofK2533109with your real Kingston University ID (e.g.K1234567) across all.javafiles AND rename the files to match. Also regenerate the diagrams (seediagrams/) so the class names in the images show your ID.
src/com/kingston/icecream/
model/ enums (base, flavor, topping, sauce, packaging, serving) + Customer, Feedback
decorator/ Decorator pattern - pricing/description engine
builder/ Builder pattern - assembles a custom IceCream
state/ State pattern - order lifecycle states
observer/ Observer pattern - Observer/Subject + notifiers
strategy/ Strategy pattern - payment methods + discounts
service/ Order (State context + Observer subject), OrderService (Map + FIFO Queue),
FeedbackService, PromotionService
app/ Swing GUI (MainFrame controller + 5 step panels) + Main + DemoRunner
diagrams/ class diagram + flowchart (Graphviz .dot sources and rendered .png)
screenshots/ GUI screenshots and console output evidence
- JDK 17 or newer (developed and tested on OpenJDK 21).
From the project root:
find src -name "*.java" > sources.txt
javac -d out @sources.txtjava -cp out com.kingston.icecream.app.K2533109_MainThe app walks through: Customise -> Review -> Payment -> Tracking -> Feedback.
java -cp out com.kingston.icecream.app.K2533109_DemoRunnerThis exercises all five patterns end to end and prints the output used as evidence in the report.
| Pattern | Key classes |
|---|---|
| Builder | builder/K2533109_IceCreamBuilder, builder/K2533109_IceCream |
| Decorator | decorator/K2533109_IceCreamComponent + *Decorator classes |
| Observer | observer/K2533109_Observer, K2533109_Subject; service/K2533109_Order, K2533109_PromotionService; app/K2533109_TrackingPanel |
| Strategy | strategy/K2533109_PaymentStrategy (+Card/Wallet/QR), K2533109_DiscountStrategy (+None/Percentage/Flat) |
| State | state/K2533109_OrderState + New/Preparing/Ready/OutForDelivery/Delivered |