Last active
June 23, 2018 08:10
-
-
Save XanderVi/b2d073cb199a11ce2df8adbf50b3ed0b to your computer and use it in GitHub Desktop.
mission Vacation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AIRPLANE_SPEED = 900 # km/h | |
TRAIN_SPEED = 120 # km/h | |
CAR_SPEED = 100 # km/h | |
ONE_MILE = 1.609344 # km | |
AIRPLANE_PRICE = 100 # per 1h | |
TRAIN_PRICE = 1 # per 1h | |
CAR_PRICE = 1.5 # per 1h | |
class Transport(object): | |
def travel(self, distance, money): | |
self.distance = distance | |
self.money = money | |
d = self.miles_into_km(distance) | |
t = self.time(d) | |
p = self.price(t) | |
m = self.money_left(p) | |
return 'Distance: ..., Time: ..., Price: ..., Money left: ...' | |
def miles_into_km(self, text): | |
return 'right distance' | |
def time(self, distance): | |
raise NotImplementedError() | |
def price(self, travel_time): | |
raise NotImplementedError() | |
def money_left(self, travel_price): | |
raise 'my money' | |
class Airplane(Transport): | |
def time(self, distance): | |
speed = AIRPLANE_SPEED | |
return 'time' | |
def price(self, travel_time): | |
travel_price = AIRPLANE_PRICE | |
return 'price' | |
person_1 = Airplane() | |
person_1.travel('1860 miles', 21650) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment