Product Management System
This is a simple product management system implemented in Python. It allows you to add, update, and manage products, as well as track available stock and handle sales.
Features
Add Product: Add a new product to the catalog. Update Price: Update the price of an existing product. Update Quantity: Update the quantity of an existing product. Sell Product: Sell a specified quantity of a product. Available Stock: View all available products and their details.
Class Structure
Product
The Product
class manages individual products and maintains a catalog of all products.
product_id
: Unique identifier for the product.product_name
: Name of the product.product_description
: Description of the product.product_price
: Price of the product.product_quantity
: Quantity of the product available in stock.online_products
: Class dictionary to store all products.
Methods
__init__(self, product_id, product_name, product_description, product_price, product_quantity)
: Initializes a new product and adds it to the catalog.add_product(self)
: Prompts user input to add a new product.update_price(self, new_price)
: Updates the price of the product.update_quantity(self, new_quantity)
: Updates the quantity of the product.sell(self, quantity_sold)
: Sells a specified quantity of the product.available_stock(cls)
: Class method to display all available products and their details.start(cls)
: Class method to start the interactive menu for managing products.
Getting Started
To get started with this project, clone the repository and run the script.
Prerequisites
- Python 3.x
Installation
-
Clone the repository:
git clone https://github.com/yourusername/product-management-system.git
-
Navigate to the project directory:
cd product-management-system
-
Run the script:
python product_management.py
Usage
When you run the script, you will see a menu with the following options:
- Available stock: View all products in the catalog.
- Update price: Update the price of an existing product.
- Update quantity: Update the quantity of an existing product.
- Purchase: Sell a specified quantity of a product.
- Add new product: Add a new product to the catalog.
- Exit: Exit the program.
Follow the prompts to manage the products in your catalog.
Example
An initial product is created for demonstration purposes:
- Product ID:
12345
- Product Name:
Toyota Yaris
- Description:
Fairly used car
- Price:
$1500.00
- Quantity:
10
Run the script and use the menu to interact with this product and add new ones.