-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
135 lines (101 loc) · 5.15 KB
/
Copy pathmain.cpp
File metadata and controls
135 lines (101 loc) · 5.15 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <iostream>
#include<string>
#include<string.h>
#include "Office.h"
#include "customer.h"
#include "ListCustomer.h"
#include "ListEmployee.h"
#include "Employee.h"
using namespace std;
int main()
{
//FULL TESTING ON OFFICE LIST AND CUSTOMER CLASS
Office *Off1=new Office("Office One");
Office *Off2=new Office("Office Two");
customer *cus1=new customer("Jan","Nowak",1,2000,2000);
customer *cus2=new customer("Piotr","Kowalski",3,5000,500);
customer *cus3=new customer("Tomasz","Matejko",2,1000,100);
customer *cus4=new customer("Brad","Pitt",7,15000,-100);
customer *cus5=new customer("Anna","Arbuz",55,3000,1000);
cus1->print();
cus1->printmyEmployee(Off1); //add to office that doesn't belongs
cus1->leaveOffice(Off1); //leave office doesnt' belongs
cus1->showMeListoffreeEmployee(Off1); //show empty list
cus1->modifySalary(Off1,1000); //modify salary in office that doeasn't belongs
cout<<"-----------"<<endl;
Off1->fire_Employee(2); //fire employee from empty list
Off1->printListofEmployee(); //print empty list
Off1->removeCustomerFromOffice(2); //remove customer from empty office
cout<<"-----------"<<endl;
Off1->hire_Employee("Adam","Mickiewicz",500,11); //hire Employee with the same code
Off1->hire_Employee("Adam","Mickiewicz",500,11);
cout<<"-----------"<<endl;
Off1->hire_Employee("Pawel","Zarzeczny",100,12);
Off1->hire_Employee("Michal","Aniol",3000,13);
Off1->hire_Employee("Lukas","Guy",2000,7);
Off1->hire_Employee("Tomasz","Chrobry",100,47);
Off1->hire_Employee("Michal","Aniol",3000,70); //hire more than 5 employee
cout<<"-----------"<<endl;
Off1->printListofEmployee(); //print list of employees
cout<<"-----------"<<endl;
cus4->choseOfficeandEmployee(Off1,12); //choose employee with negative balance
cout<<"-----------"<<endl;
cus1->choseOfficeandEmployee(Off1,14); //check if i can choose employee thats not in the office should be rejected
cus1->choseOfficeandEmployee(Off1,13); //check if i can choose employee i can't afford should be rejected
cus1->choseOfficeandEmployee(Off1,12); //check if i can choose employee i can afford should be added to list
cus1->choseOfficeandEmployee(Off1,11); //chec if i can choose another employee from the same office, should be rejected
cout<<"-----------"<<endl;
cus1->printmyEmployee(Off1); //print who is my employee
cus2->choseOfficeandEmployee(Off1,12);
cus2->printmyEmployee(Off1);
cus3->choseOfficeandEmployee(Off1,12);
cus3->printmyEmployee(Off1);
cout<<"-----------"<<endl;
cus5->choseOfficeandEmployee(Off1,12); //choose employee that has 3 customers
cout<<"-----------"<<endl;
cus5->showMeListoffreeEmployee(Off1); //show list of employee check it if they are really free
cus5->choseOfficeandEmployee(Off1,47); //check if they are free
cus5->printmyEmployee(Off1); //check who is my employee
cus5->checkMybalance(); //check my balance did it changed
cout<<"-----------"<<endl;
Off1->printListofCustomers(); //print list of customers
Off1->fire_Employee(12); //fire employee that had 3 customers
cout<<"-----------"<<endl;
Off1->printListofCustomers(); //check if customers still on list
Off1->printListOfEmployeesCustomers(12); //check if fired employee has no customers
Off1->printCustomersEmployee(1); //office prints customers employee
cus1->printmyEmployee(Off1); //print my employee who was fired, check if i was informed about it
cout<<"-----------"<<endl;
cus1->leaveOffice(Off1); //leave office
cus1->checkMybalance(); //check my balance after leaving office and after fired employee
Off1->printListofCustomers(); //print list of customers after leaving one of customers
cout<<"-----------"<<endl;
cus5->printmyEmployee(Off1); //print customer of fired employee
cout<<"-----------"<<endl;
Off1->fire_Employee(47); //fire employee again
Off1->printListofCustomers(); //print list of customers if everything ok
cus5->leaveOffice(Off1); //leave office check if was informed about fired employee
Off1->printListofCustomers(); //print list of customers check everything ok
cout<<"-----------"<<endl;
cus3->modifySalary(Off1,100); //modify salary you should be rejected from office becouse you can't afford it anymore
cus3->checkMybalance(); //check balance
cus3->checkSalary(); //check salary is it modified
cout<<"-----------"<<endl;
cus2->modifySalary(Off1,8000); //modify salary
cus2->checkMybalance(); //check balance did it changed
cus2->checkSalary(); //check salary did it changed
cout<<"-----------"<<endl;
cus3->setSalary(7000);
cus3->choseOfficeandEmployee(Off1,12);
cout<<"-----------"<<endl;
Off1->printListOfEmployeesCustomers(12); //check if can choose employee which was fired
cout<<"-----------"<<endl;
Off2->hire_Employee("Adam","Mickiewicz",500,11); //hire second office
cus1->choseOfficeandEmployee(Off2,11); //check if can go to other offices
cout<<"-----------"<<endl;
cus1->checkMybalance(); //control balance
cout<<"-----------"<<endl;
Off2->fire_Employee(11); //fire employee check if there is enough employee
delete Off1;
delete Off2;
}