-
Notifications
You must be signed in to change notification settings - Fork 1
/
Car.py
74 lines (62 loc) · 2.67 KB
/
Car.py
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
class Car(object):
"""docstring for Car"""
model = ""
brand = ""
price = ""
engineSize = ""
fuelType = ""
overall_rat = ""
def __init__(self, attributes):
super(Car, self).__init__()
self.attributes = attributes
self.merge_attributes()
def merge_attributes(self):
self.model = self.attributes[0]
self.brand = self.attributes[1]
self.price = self.attributes[3]
self.engineSize = self.attributes[4]
self.fuelType = self.attributes[5]
self.overall_rat = self.attributes[6]
def print_attributes(self):
s = "Model: " + self.model + "\nBrand: " + self.brand + "\nPrice: " + self.price + "\nEngine Size: " + self.engineSize + "\nFuel Type: " + self.fuelType + "\nOverall Ratings: " + self.overall_rat
return s
class Sedan(Car):
"""docstring for Sedan"""
def __init__(self, attributes):
super().__init__(attributes)
self.label = "Sedan"
def print_attributes(self):
s = "Label: " + self.label + "\nModel: " + self.model + "\nBrand: " + self.brand + "\nPrice: " + self.price + "\nEngine Size: " + self.engineSize + "\nFuel Type: " + self.fuelType + "\nOverall Ratings: " + self.overall_rat
return s
class SUV(Car):
"""docstring for SUV"""
def __init__(self, attributes):
super().__init__(attributes)
self.label = "SUV"
def print_attributes(self):
s = "Label: " + self.label + "\nModel: " + self.model + "\nBrand: " + self.brand + "\nPrice: " + self.price + "\nEngine Size: " + self.engineSize + "\nFuel Type: " + self.fuelType + "\nOverall Ratings: " + self.overall_rat
return s
class MPV(Car):
"""docstring for SUV"""
def __init__(self, attributes):
super().__init__(attributes)
self.label = "MPV"
def print_attributes(self):
s = "Label: " + self.label + "\nModel: " + self.model + "\nBrand: " + self.brand + "\nPrice: " + self.price + "\nEngine Size: " + self.engineSize + "\nFuel Type: " + self.fuelType + "\nOverall Ratings: " + self.overall_rat
return s
class Hatchback(Car):
"""docstring for SUV"""
def __init__(self, attributes):
super().__init__(attributes)
self.label = "Hatchback"
def print_attributes(self):
s = "Label: " + self.label + "\nModel: " + self.model + "\nBrand: " + self.brand + "\nPrice: " + self.price + "\nEngine Size: " + self.engineSize + "\nFuel Type: " + self.fuelType + "\nOverall Ratings: " + self.overall_rat
return s
class Pickup(Car):
"""docstring for Sedan"""
def __init__(self, attributes):
super().__init__(attributes)
self.label = "Pickup"
def print_attributes(self):
s = "Label: " + self.label + "\nModel: " + self.model + "\nBrand: " + self.brand + "\nPrice: " + self.price + "\nEngine Size: " + self.engineSize + "\nFuel Type: " + self.fuelType + "\nOverall Ratings: " + self.overall_rat
return s