-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcustomer.h
82 lines (61 loc) · 1.56 KB
/
customer.h
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
76
77
78
79
80
81
82
/**
* Customer.h
* Customer class includes customerID, lastName, string firstName,
* and vector<string> to store customer history.
*
* @author Olga Kuriatnyk
*/
#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <iostream>
#include <set>
#include <string>
#include <vector>
#include "movie.h"
using namespace std;
class Customer {
public:
// explicit constructor
explicit Customer(int id);
// default destuctor
~Customer() = default;
// copy constructor not allowed
Customer(const Customer &c) = delete;
// move not allowed
Customer(Customer &&other) = delete;
// assignment not allowed
Customer &operator=(const Customer &other) = delete;
// move assignment not allowed
Customer &operator=(Customer &&other) = delete;
// @return user ID
int getID() const;
// @return user last name
string getLastName() const;
// @return user first name
string getFirstName() const;
// reads the line from the file and sets the values to this object
void read(istream &is);
// add note to the customers' history
void insertHistory(const string &str);
// @return true if customer has borrowd the movie
bool findHistory(const string &str);
// print customer history
void printCustomerHistory() const;
private:
int customerID;
string lastName;
string firstName;
// to store customer history
vector<string> customerHistory;
};
class CustomerFactory {
public:
// @return new Customer object
static Customer *create(int id) {
if (id >= 1000 && id <= 9999) {
return new Customer(id);
}
return nullptr;
}
};
#endif