Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

CPIT252 - Perfume Store System

This repository contains a Java-based course project for CPIT252.
The main idea of the project is to simulate a simple perfume store system using multiple object-oriented design patterns to organize the code and separate responsibilities.

Project Overview

The system demonstrates how a perfume store can handle:

  • product creation
  • configuration management
  • discount application
  • payment processing
  • simplified store operations through a facade layer

The project is implemented in Java and structured as a desktop/console-based application.

Design Patterns Used

1. Singleton Pattern

Used in ConfigManager to ensure that only one configuration manager object exists in the system.

Purpose:
Manage shared configuration values such as currency and region.

2. Factory Pattern

Used in perfumeFactory to create perfume objects based on the selected type.

Purpose:
Encapsulate object creation and avoid direct instantiation in the main program.

3. Decorator Pattern

Used through ProductDecorator and DiscountDecorator.

Purpose:
Add extra behavior to products dynamically, such as applying discounts without modifying the original perfume classes.

4. Strategy Pattern

Used through PaymentStrategy, PayPalPayment, CreditCardPayment, and PaymentContext.

Purpose:
Allow switching between different payment methods at runtime.

5. Facade Pattern

Used in StoreFacade.

Purpose:
Provide a simple unified interface for the main store operations such as creating products, applying discounts, accessing configuration, and processing payments.

Main Classes

Product-related classes

  • perfume → abstract base class for all perfumes
  • Channel → represents Chanel No. 5
  • Dior → represents Dior Sauvage
  • Marc → represents Marc Jacobs Daisy
  • perfumeFactory → creates perfume objects

Discount-related classes

  • ProductDecorator → abstract decorator for perfume objects
  • DiscountDecorator → applies a discount to a perfume

Payment-related classes

  • PaymentStrategy → interface for payment behavior
  • PayPalPayment → PayPal payment implementation
  • CreditCardPayment → credit card payment implementation
  • PaymentContext → executes the selected payment strategy

Configuration and system classes

  • ConfigManager → manages system configuration using Singleton
  • StoreFacade → provides simplified access to core store features
  • Project252 → main entry point of the application

Features

  • Create different perfume products
  • Display product name, price, and description
  • Apply discount to selected products
  • Choose between multiple payment methods
  • Read configuration values such as currency and region
  • Demonstrate multiple design patterns in one practical project

Project Structure

CPIT252/
│
├── project252/
│   ├── src/project252/
│   │   ├── perfume.java
│   │   ├── Channel.java
│   │   ├── Dior.java
│   │   ├── Marc.java
│   │   ├── perfumeFactory.java
│   │   ├── ProductDecorator.java
│   │   ├── DiscountDecorator.java
│   │   ├── PaymentStrategy.java
│   │   ├── PayPalPayment.java
│   │   ├── CreditCardPayment.java
│   │   ├── PaymentContext.java
│   │   ├── ConfigManager.java
│   │   ├── StoreFacade.java
│   │   └── Project252.java
│
└── Project_CPIT_252/
    └── src/project_cpit_252/

How to Run

  1. Clone the repository:
git clone https://github.com/Reemajez/CPIT252.git
  1. Open the project in NetBeans or any Java IDE.

  2. Navigate to the main source folder:

project252/src/project252/
  1. Run the main class:
Project252.java

Example Workflow

When the program runs, it can:

  1. load configuration settings
  2. create a perfume product
  3. apply a discount to the product
  4. ask the user to choose a payment method
  5. process the payment and display the result

Educational Purpose

This project was developed for the CPIT252 course to practice:

  • object-oriented programming
  • clean class design
  • software design patterns
  • separation of concerns
  • practical Java development

About

This project for CPIT252

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages