-
Notifications
You must be signed in to change notification settings - Fork 1
/
vehicle.py
45 lines (42 loc) · 810 Bytes
/
vehicle.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
class Vehicle:
def __init__(self,year,price):
self.year=year
self.price=price
class Car(Vehicle):
wheel_count = 4
capacity = 6
def pay_tax(self):
pajak = float(self.price*0.15)
return pajak
def park(self,hour,capacity):
biaya = 4*hour*1250
if (capacity>5):
biaya=biaya+5000
return biaya
else:
return biaya
class Motorbike(Vehicle):
wheel_count = 2
capacity = 2
def pay_tax(self):
pajak = float(self.price*0.1)
return pajak
def park(self,hour,capacity):
biaya = 2*hour*1250
if (capacity>5):
biaya=biaya+5000
return biaya
else:
return biaya
class Bicycle(Vehicle):
wheel_count = 2
capacity = 1
def pay_tax(self):
return 0
def park(self,hour,capacity):
biaya = 2*hour*1250
if (capacity>5):
biaya=biaya+5000
return biaya
else:
return biaya