This assignment consists of two tasks that focus on applying design patterns and principles in Python programming. The goal is to enhance your understanding of object-oriented programming concepts, specifically the Factory Pattern and SOLID principles.
- Implement a system for creating vehicles using the Factory Pattern.
- Create an abstract base class
Vehiclewith a methodstart_engine(). - Modify the existing
CarandMotorcycleclasses to inherit fromVehicle. - Create an abstract class
VehicleFactorywith methodscreate_car()andcreate_motorcycle(). - Implement two factory classes:
USVehicleFactoryandEUVehicleFactoryto create vehicles with regional specifications. - Update the initial code to utilize these factories for vehicle creation.
- Refactor a library management program that allows adding, removing, and displaying books.
- Create a
Bookclass to adhere to the Single Responsibility Principle (SRP). - Ensure the
Libraryclass is extendable without modification to comply with the Open/Closed Principle (OCP). - Implement the Liskov Substitution Principle (LSP) by ensuring any class inheriting from
LibraryInterfacecan replace theLibraryclass seamlessly. - Use the
LibraryInterfaceto specify necessary methods for interaction, following the Interface Segregation Principle (ISP). - Ensure higher-level classes depend on abstractions, adhering to the Dependency Inversion Principle (DIP).

