-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEmployee.cpp
More file actions
115 lines (95 loc) · 1.6 KB
/
Copy pathEmployee.cpp
File metadata and controls
115 lines (95 loc) · 1.6 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include <iostream>
#include<string.h>
#include<vector>
#include <algorithm>
using namespace std;
#include "Employee.h"
#include "ListCustomer.h"
employee::employee(string name, string surname,int cost,int ID)
{
this->cost=cost;
this->ID=ID;
this->Name=name;
this->Surname=surname;
this->next=NULL;
}
employee::~employee()
{
cout<<"delete employee"<<endl;
this->removeALLmyCustomers();
}
employee* employee::getNext()
{
return next;
}
void employee::setNext(employee *n)
{
next=n;
}
string employee::getName()
{
return Name;
}
string employee::getSurname()
{
return Surname;
}
int employee::getID()
{
return ID;
}
int employee::getcost()
{
return cost;
}
int employee::numberOfmyCus()
{
numberOfCus=myCust.size();
return numberOfCus;
}
void employee::addMyCustomer(customer *ptr)
{
myCust.push_back(ptr);
}
void employee::removeMyCustomer(int id)
{
for (int y=0;y<myCust.size();y++)
{
if(myCust[y]->getIDcard()==id)
{
myCust.erase(myCust.begin()+y);
}
}
}
customer* employee::getMyCustomer(int i)
{
return myCust[i];
}
void employee::printMyCustomers()
{
int i;
if(myCust.size()!=0)
{
cout<<"your customers are:"<<endl;
for(i=0;i<myCust.size();i++)
myCust[i]->print();
}
else
cout<<"you have no customers"<<endl;
}
void employee::removeALLmyCustomers()
{
myCust.clear();
cout<<"you have no customers"<<endl;
}
bool employee::isLess()
{
if(myCust.size()<MAX)
return true;
else
return false;
}
void employee::print()
{
cout <<this->Name <<" "<<this->Surname<<" "<<this->cost<<" "<<this->ID<<endl;
}