diff options
Diffstat (limited to 'algo1w4d2/Kassa.cpp')
-rw-r--r-- | algo1w4d2/Kassa.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/algo1w4d2/Kassa.cpp b/algo1w4d2/Kassa.cpp new file mode 100644 index 0000000..e1ee46d --- /dev/null +++ b/algo1w4d2/Kassa.cpp @@ -0,0 +1,23 @@ +#include "Kassa.h" + +#include "consts.h" + +Kassa::Kassa() { _queue = new Queue(); } +Kassa::~Kassa() { delete _queue; } + +std::ostream& operator << (std::ostream& output, const Kassa& k) { + for (unsigned i = 0; i < k._queue->size(); i++) + output << "* "; + return output; +} + +void Kassa::add_customer(const Klant& k) { + _queue->insert(k); +} + +void Kassa::step() { + for (unsigned i = 0; i < MAX_TRANSACTION_PER_CHECKOUT; i++) { + if (_queue->size() == 0) break; + delete _queue->remove().release(); + } +} |