The Travel Package Management System is a Java-based application designed to manage travel packages, allowing users to book and manage travel itineraries.
The project is organized into several packages, each serving a specific purpose:
-
builder: Contains builder classes responsible for constructing complex objects like TravelPackage and Destination.
-
director: Holds the TravelPackageDirector class, which facilitates the construction of complete travel packages.
-
model: Includes classes representing the core entities of the system, such as Activity, Destination, EnrolledActivity, Passenger, and TravelPackage.
-
strategy: Houses different pricing strategy implementations used for calculating activity prices based on the type of passenger.
-
config: Contains all the constants and demo activites, passenger to run the program
The Builder Pattern is employed in the construction of complex objects (TravelPackage
and Destination
).
The Strategy Pattern is utilized for pricing strategies, allowing the system to calculate prices dynamically based on the passenger type. Different pricing strategies (StandardPricingStrategy
, PremiumPricingStrategy
, and GoldPricingStrategy
) implement the common PricingStrategy interface.
The Composite Pattern is implicitly applied through the ItineraryComponent
interface. Both Activity
and Destination
implement this interface, enabling a unified approach to printing the itinerary.
Here, Destination
is the composite and Activity
is leaf
The Singleton Pattern is employed in the pricing strategy implementations (StandardPricingStrategy
, PremiumPricingStrategy
, and GoldPricingStrategy
). It ensures that a class has only one instance and provides a global point of access to it. The pattern is implemented using the double-checked locking mechanism to achieve thread safety and lazy initialization.