-
Notifications
You must be signed in to change notification settings - Fork 4
/
LandTransportT4.cpp
131 lines (108 loc) · 4.29 KB
/
LandTransportT4.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
130
131
#include "LandTransportT4.h" // class implemented
#include<string>
using namespace std;
// File scope starts here
/////////////////////////////// PUBLIC ///////////////////////////////////////
//============================= LIFECYCLE ====================================
// LandTransport Default+Overloaded Constructor
LandTransport::LandTransport(float aWeight, const string& aCapacity, float aSpeed, const string& aTransportationMode, const string& aVehicleType) : mTransportationMode(aTransportationMode), mVehicleType(aVehicleType), Transport(aWeight, aCapacity, aSpeed) {
this->SetLandTransport(aTransportationMode, aVehicleType);
}
// end LandTransport constructor
//============================= OPERATIONS ===================================
// Pure virtual function that ships goods.
void LandTransport::Ship() {
cout << "\nIn land transport, shipping is done via truck" << endl;
}
// end function Ship
//============================= ACESS ===================================
// function that sets Weight
void LandTransport::SetWeight(float aWeight) {
Transport::SetWeight(aWeight);
}
// end function SetWeight
// function that sets Capacity
void LandTransport::SetCapacity(const string& aCapacity) {
Transport::SetCapacity(aCapacity);
}
// end function SetCapacity
// function that sets Speed
void LandTransport::SetSpeed(float aSpeed) {
Transport::SetSpeed(aSpeed);
}
// end function SetSpeed
// function that sets Transport
void LandTransport::SetTransport(float aWeight, const string& aCapacity, float aSpeed) {
Transport::SetTransport(aWeight, aCapacity, aSpeed);
}
// end function SetTransport
// Overloaded function that sets Transport
void LandTransport::SetTransport(const Transport& aTransport) {
Transport::SetTransport(aTransport);
}
// end function SetTransport
// function that sets mode of Transportation
void LandTransport::SetTransportationMode(const string& aTransportationMode) {
this->mTransportationMode = aTransportationMode;
}
// end function SetTransportationMode
// function that sets type of Vehicle
void LandTransport::SetVehicleType(const string& aVehicleType) {
this->mVehicleType = aVehicleType;
}
// end function SetVehicleType
// function that sets LandTransport
void LandTransport::SetLandTransport(float aWeight, const string& aCapacity, float aSpeed, const string& aTransportationMode, const string& aVehicleType) {
this->SetWeight(aWeight);
this->SetCapacity(aCapacity);
this->SetSpeed(aSpeed);
this->SetTransportationMode(aTransportationMode);
this->SetVehicleType(aVehicleType);
}
// end function SetLandTransport
// Overloaded function that sets LandTransport
void LandTransport::SetLandTransport(const string& aTransportationMode, const string& aVehicleType) {
this->SetTransportationMode(aTransportationMode);
this->SetVehicleType(aVehicleType);
}
// end function SetLandTransport
// Overloaded function that sets LandTransport
void LandTransport::SetLandTransport(const LandTransport& aLandTransport) {
this->SetLandTransport(aLandTransport.GetWeight(), aLandTransport.GetCapacity(), aLandTransport.GetSpeed(), aLandTransport.GetTransportationMode(), aLandTransport.GetVehicleType());
}
// end function SetLandTransport
// function that gets Weight
float LandTransport::GetWeight() const {
return Transport::GetWeight();
}
// end function GetWeight
// function that gets Capacity
const string& LandTransport::GetCapacity() const {
return Transport::GetCapacity();
}
// end function GetCapacity
// function that gets Speed
float LandTransport::GetSpeed() const {
return Transport::GetSpeed();
}
// end function GetSpeed
// function that gets the Transport
const Transport& LandTransport::GetTransport()const {
return Transport::GetTransport();
}
// end function GetTransport
// function that gets mode of Transportation
const string& LandTransport::GetTransportationMode() const {
return this->mTransportationMode;
}
// end function GetTransportationMode
// function that gets type of Vehicle
const string& LandTransport::GetVehicleType() const {
return this->mVehicleType;
}
// end function GetVehicleType
// function that gets the AirTransport
const LandTransport& LandTransport::GetLandTransport()const {
return *this;
}
// end function GetLandTransport