Julian Olano Medina - Software Design and Architecture Assignment 1, Winter 2024.
This project implements a design pattern assignment using both the Abstract Factory Pattern and the Factory Method Pattern. The goal is to create different grocery products (such as Bananas and Apples), set their prices after creation by reading from a data file, and demonstrate the functionality with a test driver.
This is how my project is structured:
The root of the project has all the relevent assignment files
-
GroceryProductFactory.java:- Defines the abstract factory interface that creates products and sets their prices.
-
BananaFactory.java:- Implements the
GroceryProductFactoryinterface to createBananaand set the price based on the data file. - Also includes the
BananaClass- Concrete class that represents the Banana product, extending the
GroceryProductclass.
- Concrete class that represents the Banana product, extending the
- Implements the
-
AppleFactory.java:- Implements the
GroceryProductFactoryinterface to createAppleand set the price based on the data file. - Also includes the
AppleClass- Concrete class that represents the Apple product, extending the
GroceryProductclass.
- Concrete class that represents the Apple product, extending the
- Implements the
-
GroceryProduct.java:- Abstract base class for all products, providing the blueprint for setting and getting product prices.
-
TestDriver.java:- Main test class that demonstrates the functionality of the factory pattern. It creates instances of
BananasandApplesusing the factories and sets the price from the data file.
- Main test class that demonstrates the functionality of the factory pattern. It creates instances of
This folder contains the images and graphics used for this readme file
Test driver to demonstrate that the code works using 2 examples of a product such as Bananas and Apples.

