-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransactionManager.h
More file actions
76 lines (61 loc) · 3.18 KB
/
Copy pathTransactionManager.h
File metadata and controls
76 lines (61 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// Blake Berry
// 03/08/2022
// Homework 4
// This file is an interface for the TransactionManager class. The
// TransactionManager stores customers and their purchase history for the
// collectibles store. The transactionManager does not own the memory to the
// customer or the items in the transaction it simply logs and can provide
// hisotrical information about a csutomers or the stores transaction history
//-----------------------------------------------------------------------------
#pragma once
#include "SearchTree.h"
#include "Customer.h"
#include "Transaction.h"
#include "TransactionLogEntry.h"
class TransactionManager
{
private:
// search tree filled with TransactionLogEntry items
SearchTree* transactionHistory_;
public:
//-------------------------- TransactionManager ----------------------------
// creates a transaction manager that is empty of transaction to manage
// Postconditions: creates a transaction manager that is empty of
// transactions
TransactionManager();
//------------------------- Destructor ----------------------------
// Frees the transactionHistory tree of its nodes
// Preconditions : Assumes that the collectibles and customers free their
// own dynamic memory
// Postconditions: Frees the memory associated with the transactionManager
~TransactionManager();
//------------------------- logTransaction ----------------------------
// Given a customer, item, and transaction type a transaction object is
// created and stored in the transaction history
// Preconditions : Assumes that the collectibles and customers free their
// own dynamic memory
// Postconditions: Frees the memory associated with the transactionManager
bool logTransaction(const Customer*& responsible,
const Collectible*& item,
std::string transactionType);
//------------------------- DisplayTransactionHistory ----------------------
// Traverses the transaction history tree and prints out all of the
// customers in alphebtic order and prints their transaction in chrological
// order
// Preconditions : Assumes that the print method exists for TransactionEntry
// Postconditions: prints to the console the transaction history for each
// customer. Each transaction will appear on one line
// indented by a tab under the customers name
void displayTransactionHistory() const;
//------------------------- DisplayCustomerHistory -------------------------
// Traverses the tree looking for a given customer. If found the customers
// transaction history is displayed in chronological order
// Preconditions : Assumes that the print method exists for TransactionEntry
// Postconditions: prints to the console the transaction history for the
// customer. Each transaction will appear on one line
// indented by a tab under the customers name
//
// if the customer has not made a transaction an exception
// is thrown
void displayCustomersHistroy(const Customer*& responsible) const;
};