-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCargo.cpp
84 lines (81 loc) · 1.19 KB
/
Cargo.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
#include"Cargo.h"
Cargo::Cargo (CARGO_TYPE T, const Time& PT, int id, float DD, float LT, double C) {
Preparation_Time = PT;
Load_Unload_Time = LT;
Delivery_Distance = DD;
Type = T;
Cost = C;
ID = id;
}
Cargo::Cargo(int id) //Fake cargo just for comparison with id
{
ID = id;
}
float Cargo::GetDistance() const
{
return Delivery_Distance;
}
double Cargo::GetCost() const
{
return Cost;
}
float Cargo::GetLU_Time() const
{
return Load_Unload_Time;
}
CARGO_TYPE Cargo::GetType() const
{
return Type;
}
Time& Cargo::GetPrepTime()
{
return Preparation_Time;
}
void Cargo:: PromoteToVip(double ExtraMoney)
{
Type = CARGO_TYPE::VIP;
Cost += ExtraMoney;
}
bool Cargo:: operator==(Cargo* ptr)
{
if (this->ID == ptr->ID)
return true;
return false;
}
int Cargo::GetID() const
{
return ID;
}
void Cargo::Set_Truck_ID(int id)
{
Truck_ID = id;
}
int Cargo::Get_Truck_ID()
{
return Truck_ID;
}
void Cargo::Set_DT(Time t)
{
DT = t;
}
void Cargo::Set_WT(int t)
{
WT.setTime(t);
}
Time& Cargo::Get_DT()
{
return DT;
}
Time& Cargo::Get_WT()
{
return WT;
}
Time& Cargo::Get_Preparation_Time()
{
return Preparation_Time;
}
ostream& operator<<(ostream& out, const Cargo* c)
{
out << c->GetID();
return out;
}