-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTruck.cpp
77 lines (71 loc) · 1.72 KB
/
Truck.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
#include "Truck.h"
#include "Vehicle.h"
#include<iostream>
using namespace std;
int Truck::numberOfTrucks = 0;
void Truck:: setcontainerSize(double cs) {
containerSize = cs;
}
double Truck::getcontainerSize() {
return containerSize;
}
void Truck::setcategory(char* ch) {
category = deepCopy(ch);
}
char* Truck::getcategory() {
char* temp = deepCopy(category);
return temp;
}
void Truck::setnumberOfTrucks(static int noti) {
numberOfTrucks = noti;
}
int Truck::getnumberOfTrucks() {
return numberOfTrucks;
}
Truck::Truck(Truck& obj) {
this->containerSize = obj.containerSize;
this->category = deepCopy(obj.category);
this->numberOfTrucks = obj.numberOfTrucks;
this->fourWheelDrive = obj.fourWheelDrive;
}
Truck::Truck() {
containerSize = 0;
category = nullptr;
numberOfTrucks ++;
fourWheelDrive = 0;
}
void Truck::setfourWheelDrive(bool db) {
fourWheelDrive = db;
};
bool Truck::getfourWheelDrive() {
return fourWheelDrive;
}
Truck::Truck (double cs, char* ch, int noti, bool db, char* n, char* c, int w, int p, char* v) :Vehicle(n, c, w, p, v) {
containerSize = cs;
numberOfTrucks++;
fourWheelDrive = db;
category = deepCopy(ch);
};
Truck::~Truck() {
}
void Truck:: display()const {
string fwd = "/0";
if (fourWheelDrive == 1)
{
fwd = "yes";
}
else
{
fwd = "no";
}
cout << "Company...." << "Color...." << "Wheels...." << "Power...." << "Type...." << endl;
Vehicle::display();
cout << "container size" << "...." << "...." << "category" << "...." << "...."<< "four wheels drive"<<endl;
cout << "..." << containerSize << "............." << category << "......." << "......."<< fwd;
};
void Truck::checkType() {
if (getnumberOfWheels() == 6) {
char arr[6] = { 'T','r','u','c','k','\0' };
settypeOfVehicle(arr);
}
}