-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUI.cpp
129 lines (117 loc) · 3.24 KB
/
UI.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
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
#include "UI.h"
#include<iostream>
#include"Time.h"
#include"PreparationEvent.h"
#include"CancelEvent.h"
#include"PromoteEvent.h"
#include<Windows.h>
using namespace std;
//---------------------------------------------Function to Display The Interface with Different Types-----------------------------------------------------------//
void UI::Display(Company& C, int Type, Time CurrentTime)
{
system("cls"); //Clears the console after every hour in the simulation
if (Type == 1 || Type == 2)
{
cout << "Current Time(Day:Hour) :" << CurrentTime.day << ":" << CurrentTime.hour << endl;
cout << endl;
cout << C.WaitingNormalCount()+ C.WaitingSpecialCount()+ C.WaitingVIPCount() << " Waiting Cargos: [";
C.PrintWNC();
cout << "] (";
C.PrintWSC();
cout << ") {";
C.PrintWVC();
cout << "}" << endl;
cout << "-------------------------------------------------------" << endl;
Truck* N;
Truck* S;
Truck* V;
N = C.GetNormalLoadingTruck();
S = C.GetSpecialLoadingTruck();
V = C.GetVIPLoadingTruck();
cout << C.GetLoadingTruckCount() << " Loading Trucks: ";
if (N)
{
cout << N->GetTID();
if (N->IsEmpty())
cout << "[ ] ";
else
N->PrintTruckCargos();
}
else
{
cout << " [ ] ";
}
if (S)
{
cout << S->GetTID();
if (S->IsEmpty())
cout << "( ) ";
else
S->PrintTruckCargos();
}
else
{
cout << " ( ) ";
}
if (V)
{
cout << V->GetTID();
if (V->IsEmpty())
cout << "{ } ";
else
V->PrintTruckCargos();
}
else
{
cout << " { } ";
}
cout << endl;
cout << "-------------------------------------------------------" << endl;
cout << C.GetEmptyTruckCount() << " Empty Trucks: [";
C.PrintENT();
cout << "] (";
C.PrintEST();
cout << ") {";
C.PrintEVT();
cout << "}" << endl;
cout << "-------------------------------------------------------" << endl;
cout << C.GetMovingCargoCount() << " Moving Cargos: ";
C.PrintMovingTrucks();
cout << endl;
cout << "-------------------------------------------------------" << endl;
cout << C.GetCheckupCount() << " In-Checkup Trucks: [";
C.PrintNCT();
cout << "] (";
C.PrintSCT();
cout << ") {";
C.PrintVCT();
cout << "}" << endl;
cout << "-------------------------------------------------------" << endl;
cout << C.DeliveredCount() << " Delivered Cargos:";
C.PrintDC();
cout << endl;
cout << "-------------------------------------------------------" << endl;
if (Type == 1)
cin.get();
if (Type == 2)
Sleep(1000);
}
}
//-------------------------------------------------------------End of The Display Function------------------------------------------------------------------//
//-----------------------------------------------------Function to Display The Ending Text----------------------------------------------------------------//
void UI::DisplayEndText(Company& C,int Type,Time EndSimTime)
{
cout << endl;
C.GenerateOutputFile(EndSimTime);
if (Type == 3)
{
cout << "Silent Mode " << endl;
cout << "Simulation Starts..." << endl;
cout << "Simulation ends, Output file created" << endl;
}
else
{
cout << "End Of Simulation ";
}
}
//-----------------------------------------------------------------------------------------------------------------------------------------------------//