-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathticket.cpp
51 lines (44 loc) · 949 Bytes
/
ticket.cpp
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
// Description: Implementation of a customer complaint ticket class
#include "ticket.h"
Ticket::Ticket()
{
ticketid = 0;
customername = "";
complaint = "";
}
Ticket::Ticket(unsigned int tid, std::string cname, std::string cplnt)
{
ticketid = tid;
if (cname == "")
throw std::invalid_argument("Empty Customer Name");
else
customername = cname;
if (cplnt == "")
throw std::invalid_argument("Empty Complaint");
else
complaint = cplnt;
}
unsigned int Ticket::GetID() const
{
return ticketid;
}
std::string Ticket::GetCustomer() const
{
return customername;
}
std::string Ticket::GetComplaint() const
{
return complaint;
}
bool Ticket::operator==(const Ticket& tick) const
{
if (ticketid == tick.ticketid ||
(customername == tick.customername && complaint == tick.complaint))
return true;
else
return false;
}
bool Ticket::operator!=(const Ticket& tick) const
{
return ! (*this == tick);
}