-
Notifications
You must be signed in to change notification settings - Fork 0
/
cpa_lab_6_5_9_(1)-B.cpp
115 lines (107 loc) · 2.19 KB
/
cpa_lab_6_5_9_(1)-B.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
#include <iostream>
using namespace std;
class Engine
{
public:
Engine(string capacity = "1.0") {this->capacity = capacity;}
void Print()
{
cout << "Engine: " << capacity << endl;
}
private:
string capacity;
};
class Wheel
{
public:
Wheel(int diameter = 16) {this->diameter = diameter;}
void Print()
{
cout << "Wheel: " << diameter <<"inches" << endl;
}
private:
int diameter;
};
class Chassis
{
public:
Chassis(string type = "Normal") {this->type = type;}
void Print()
{
cout << "Chassis: " << type << endl;
}
private:
string type;
};
class Lights
{
public:
Lights() {}
void SetType(string type) {this->type = type;}
void Print()
{
cout << "Light: " << type << endl;
}
private:
string type;
};
class Body
{
public:
Body(string color = "Black") {this->color = color;}
void Print()
{
cout << "Body: " << color << endl;
}
private:
string color;
};
class Car
{
public:
Car()
{
l0.SetType("Type 1");
l1.SetType("Type 1");
l2.SetType("Type 2");
l3.SetType("Type 2");
l4.SetType("Type 3");
l5.SetType("Type 3");
l6.SetType("Type 4");
l7.SetType("Type 4");
l8.SetType("Type 5");
l9.SetType("Type 5");
}
void Print()
{
engine.Print();
wh1.Print();
wh2.Print();
wh3.Print();
wh4.Print();
chassis.Print();
l0.Print();
l1.Print();
l2.Print();
l3.Print();
l4.Print();
l5.Print();
l6.Print();
l7.Print();
l8.Print();
l9.Print();
body.Print();
}
private:
Engine engine;
Wheel wh1, wh2, wh3, wh4;
Chassis chassis;
Lights l0,l1, l2,l3,l4,l5,l6,l7,l8,l9;
Body body;
};
int main()
{
Car car;
car.Print();
return 0;
}