Add factory example

This commit is contained in:
2021-05-11 15:04:58 -04:00
parent 9bb2f9867d
commit 54426cbe5b
6 changed files with 156 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
#include <array>
#include <cstdlib>
#include <iostream>
#include <vector>
#include "factory.hpp"
int main(const int argc, const char * argv[]) {
// Testing GearFactory
GearFactory gearFactory;
const int gearsRequired = 5;
std::cout << "Testing " << gearFactory.getName() <<"...\nMaking 5 Gears...\n";
for (int i = 0; i < gearsRequired; i++) gearFactory.requestPart();
std::cout << std::endl << gearFactory.getName() << " inventory:\n";
gearFactory.showStock();
// Making custom gears
for (int i = 0; i < gearsRequired; i++) gearFactory.requestPart("Big Gear", 2.5f);
std::cout << std::endl << gearFactory.getName() << " inventory:\n";
gearFactory.showStock();
}