-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagent.h
54 lines (48 loc) · 1.15 KB
/
agent.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
#ifndef AGENT_H
#define AGENT_H
#include <string>
#include <iostream>
using namespace std;
class Agent
{
public:
int id;
string name;
int assignedTickets[5];
int ticketCount;
bool isAvailable;
// Constructor
Agent(int id, const string &name)
: id(id), name(name), ticketCount(0), isAvailable(true)
{
for (int i = 0; i < 5; i++)
{
assignedTickets[i] = -1;
}
}
// method to assign tickets to the agent
bool assignTicket(int ticketID)
{
if (ticketCount < 5)
{
assignedTickets[ticketCount++] = ticketID;
if (ticketCount == 5)
{
isAvailable = false;
}
return true;
}
return false;
}
// method to Display all the ticket assigned to an Agent
void displayAssignedTickets() const
{
cout << "Agent ID: " << id << ", Name: " << name << ", Assigned Tickets: ";
for (int i = 0; i < ticketCount; i++)
{
cout << assignedTickets[i] << " ";
}
cout << (isAvailable ? "(Available)" : "(Unavailable)") << "\n";
}
};
#endif