StoryMcStoreface is a small C++ console application for viewing inventory and placing simulated orders. Payments are recorded as local IOU files; no real payment is processed.
- A C++ compiler with C++17 support
- GNU Make
This project is compatible with cpp-container docker container. If you already have the container built, just run:
docker run -v "$(pwd)":/usr/src -it cpp-containerAnd that will build and run the application.
From the project directory, run:
makeThis compiles the application with C++17 and creates the storymcstoreface executable.
Start the application with:
make runThe menu allows you to view inventory, place an order, or exit. When an order is placed, a simulated payment receipt is written to the payments/ directory.
To remove the executable, object files, and dependency files:
make clean| Command | Description |
|---|---|
make or make build |
Build the application |
make run |
Build, then launch the application |
make clean |
Remove generated build artifacts |
./test_runner.sh |
Build and run the interactive program |
The current class relationships are represented below. The diagram also highlights the direct dependencies that are candidates for future decoupling.
classDiagram
class InventoryManager {
+Product products[5]
+int productCount
+InventoryManager()
}
class Product {
+int id
+string name
+int priceCents
+int quantity
}
class OrderProcessor {
-InventoryManager inventory
-int nextOrderNumber
+OrderProcessor(InventoryManager inventory)
+bool placeOrder(int productId, int quantity, string customerName, string customerEmail, string cardLastFour)
}
class PaymentProcessor {
+bool chargeCreditCard(string customerName, string cardLastFour, int totalCents, string orderId)
}
class NotificationService {
+void sendEmail(string recipient, string subject, string message)
}
InventoryManager *-- Product : stores
OrderProcessor --> InventoryManager : reads and updates
OrderProcessor ..> PaymentProcessor : creates
OrderProcessor ..> NotificationService : creates
Planned improvements include encapsulating inventory storage, injecting payment and notification interfaces into OrderProcessor, and isolating payment persistence behind a repository abstraction.