Esempio n. 1
0
from tesla import Tesla
from ram import Ram
from cessna import Cessna
from zero import Zero
# my_tesla = Tesla()

# my_tesla.main_color = "blue"

# print(my_tesla.main_color)

fxs = Zero()
modelS = Tesla()
mx410 = Cessna()
dodgeRam = Ram()

fxs.drive()
modelS.drive()
mx410.drive()
dodgeRam.drive()
Esempio n. 2
0
from fiat import Fiat
from jeep import Jeep
from lamborghini import Lamborghini
from tesla import Tesla

acura = Acura("gray")
fiat = Fiat("golden")
jeep = Jeep("red")
lamborghini = Lamborghini("yellow")
tesla = Tesla("blue")

acura.drive()
acura.turn("right")
acura.stop()
print()
fiat.drive()
fiat.turn("left")
fiat.stop()
print()
jeep.drive()
jeep.turn("right")
jeep.stop()
print()
lamborghini.drive()
lamborghini.turn("left")
lamborghini.stop()
print()
tesla.drive()
tesla.turn("right")
tesla.stop()
Esempio n. 3
0
# car1 = Vehicle("Porsche", "Black", 140)
# car2 = Vehicle("Jaguar", "Gray", 100)
# car3 = Vehicle("Audi", "Red", 110)
# car4 = Vehicle("BMW", "White", 120)
# car5 = Vehicle("Subaru", "Blue", 200)

# Create a drive() method in the Vehicle class.
# Override the drive() method in all the other vehicle classes. Include the vehicle's color in the message (i.e. "The blue Ram drives past. RRrrrrrummbbble!").

# Create a turn(self, direction) method, and a stop(self) method on Vehicle. Define a basic implementation of each.

# Override all three of those methods on some of the vehicles. For example, the stop() method for a plane would be to output the message "The white Cessna rolls to a stop after rolling a mile down the runway."
# Make your vehicle instances perform all three behaviors.

model_s = Tesla()
fxs = Zero()
mx410 = Cessna()
e350 = MB()

model_s.drive()
fxs.drive()
mx410.drive()
e350.drive()

fxs.turn("left")
fxs.stop()

e350.turn("left")
fxs.stop()