Skip to content

Instantly share code, notes, and snippets.

@jeroos
Created October 30, 2024 04:07
Show Gist options
  • Save jeroos/9cae1949a49a64f9f4a57ee28ce4b73b to your computer and use it in GitHub Desktop.
Save jeroos/9cae1949a49a64f9f4a57ee28ce4b73b to your computer and use it in GitHub Desktop.

Inventory Management System

Objective

Create a console-based inventory management system for a small store with real-time tracking and alerts.

Technical Requirements

1. Data Structures

class Product {
    public string ProductId { get; set; }  // Format: XXX-999
    public string Name { get; set; }
    public int Quantity { get; set; }
    public decimal Price { get; set; }
    public Category Category { get; set; }
    public DateTime LastRestocked { get; set; }
}

enum Category {
    Electronics,
    Clothing,
    Food,
    Books
}

2. Required Functionality

a) Product Management

  • Add new products with validation:
    • ProductId: Unique, format XXX-999
    • Name: 3-50 characters
    • Quantity: Non-negative
    • Price: Between $0.01 and $10000.00
    • Category: Must be valid enum value
  • Update existing products
  • Remove products
  • Track last restock date

b) Inventory Operations

  • Stock increase (restock)
  • Stock decrease (sales)
  • Low stock alerts (< 5 items)
  • Out of stock alerts
  • Calculate total inventory value
  • Track product turnover

c) Reporting

  • List all products
  • Filter by:
    • Category
    • Price range
    • Stock level
  • Sort by:
    • Name
    • Quantity
    • Price
    • Last restock date

d) Alerts System

  • Immediate alerts for:
    • Low stock items
    • Out of stock items
    • High value items (>$1000)
  • Daily inventory summary

3. User Interface Requirements

  • Main menu with numbered options
  • Sub-menus for specific functions
  • Clear success/error messages
  • Confirmation for critical actions
  • Format currency values properly
  • Format dates consistently

4. Data Validation

  • Prevent duplicate ProductIds
  • Validate quantity changes
  • Verify price updates
  • Check category assignments
  • Validate date entries

Sample Interaction

=== Inventory Management System ===
1. View Inventory
2. Add Product
3. Update Stock
4. Generate Reports
5. View Alerts
6. Exit

Enter choice (1-6): 1

Current Inventory:
ID      Name            Qty   Price   Category    Last Restocked
-----------------------------------------------------------
ABC-123 Laptop         10    $899.99  Electronics 10/28/2024
DEF-456 T-Shirt        25    $19.99   Clothing   10/27/2024
GHI-789 Novel          8     $14.99   Books      10/25/2024

Low Stock Alert: Novel (8 units)
Total Inventory Value: $9,499.64

Enter product ID to view details or 'M' for menu:

Evaluation Criteria

1. Code Organization (25%)

  • Class structure
  • Method organization
  • Variable naming
  • Code documentation
  • Implementation efficiency

2. Data Management (25%)

  • Storage implementation
  • Update handling
  • Search efficiency
  • Sort implementation
  • Alert system

3. Error Handling (25%)

  • Input validation
  • Exception management
  • Edge cases
  • Recovery procedures
  • User feedback

4. User Interface (25%)

  • Menu clarity
  • Information display
  • Navigation logic
  • Error messages
  • Overall usability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment