from zero import Zero from cessna import Cessna from ram import Ram from tesla import Tesla fxs = Zero() fxs.main_color = "red" fxs.drive() fxs.turn("right") fxs.stop() modelS = Tesla() modelS.main_color = "green" modelS.drive() modelS.turn("left") modelS.stop() mx410 = Cessna() mx410.main_color = "white" mx410.drive() mx410.turn("right") mx410.stop() ram1500 = Ram() ram1500.main_color = "orange" ram1500.drive() ram1500.turn("left") ram1500.stop()
# 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()