def main(): a_taxi = Taxi("Prius 1", 100) a_taxi.drive(40) print (a_taxi, " = ", a_taxi.get_fare()) a_taxi.start_fare() a_taxi.drive(18) print(a_taxi, " = ", a_taxi.get_fare())
def run_tests(): """Run tests to show workings of Car and Taxi classes.""" bus = Car("Datsun", 180) bus.drive(30) print("fuel =", bus.fuel) print("odo =", bus.odometer) bus.drive(55) print("fuel =", bus.fuel) print("odo = ", bus.odometer) print(bus) distance = int(input("Drive how far? ")) while distance > 0: travelled = bus.drive(distance) print("{} travelled {}".format(str(bus), travelled)) distance = int(input("Drive how far? ")) t = Taxi("Prius 1", 100) print(t) t.drive(25) print(t, t.get_fare()) t.start_fare() t.drive(40) print(t, t.get_fare()) sst = SilverServiceTaxi("Limo", 100, 2) print(sst, sst.get_fare()) sst.drive(10) print(sst, sst.get_fare())
def main(): #Testing Taxi test_taxi = Taxi("Prius 1", 100) test_taxi.drive(40) print(test_taxi) test_taxi.start_fare() test_taxi.drive(100) test_taxi.get_fare() print(test_taxi) #Testing Unreliable_Car test_unreliable_car = UnreliableCar("Car 1", 30, 50) test_unreliable_car.drive(10) print(test_unreliable_car) test_unreliable_car.drive(10) print(test_unreliable_car) test_unreliable_car.drive(10) print(test_unreliable_car) #Testing SilverServicesTaxis test_silvertaxi = SilverServiceTaxi("Hummer", 200, 4.0) test_silvertaxi.drive(40) print(test_silvertaxi)
def Start_Testing(): """Run tests to show workings of Car and Taxi classes.""" bus = Car("Datsun", 180) bus.drive(30) print("fuel =", bus.fuel) print("odo =", bus.odometer) bus.drive(55) print("fuel =", bus.fuel) print("odo = ", bus.odometer) print(bus) #I will need to loop bus distance = int(input("Drive how far? ")) while distance > 0: travelled = bus.drive(distance) print("{} travelled {}".format(str(bus), travelled)) distance = int(input("Drive how far? ")) Taxi_2 = Taxi("Prius 1", 100) print(Taxi_2) Taxi_2.drive(25) print(Taxi_2, Taxi_2.get_fare()) Taxi_2.start_fare() Taxi_2.drive(40) print(Taxi_2, Taxi_2.get_fare()) SilverTaxi = SilverServiceTaxi("Limo", 100, 2) print(SilverTaxi, SilverTaxi.get_fare()) SilverTaxi.drive(10) print(SilverTaxi, SilverTaxi.get_fare())
def main(): new_cab = Taxi("Prius 1", 100) new_cab.drive(60) new_cab.get_fare() new_cab.odometer print("{}, fare ${}".format(new_cab, new_cab.get_fare()))
def run_tests(): bus = Car("Datsun", 180) bus.drive(30) print("fuel =", bus.fuel) print("odo =", bus.odometer) bus.drive(55) print("fuel =", bus.fuel) print("odo = ", bus.odometer) print(bus) # drive bus (input/loop is oblivious to fuel) distance = int(input("Drive how far? ")) while distance > 0: travelled = bus.drive(distance) print("{} travelled {}".format(str(bus), travelled)) distance = int(input("Drive how far? ")) t = Taxi("Prius 1", 100) print(t) t.drive(25) print(t, t.get_fare()) t.start_fare() t.drive(40) print(t, t.get_fare()) sst = SilverServiceTaxi("Limo", 100, 2) print(sst, sst.get_fare()) sst.drive(10) print(sst, sst.get_fare())
def run_tests(): bus = Car("Datsun", 180) bus.drive(30) print("fuel =", bus.fuel) print("odo =", bus.odometer) bus.drive(55) print("fuel =", bus.fuel) print("odo = ", bus.odometer) print(bus) distance = int(input("Drive how far? ")) while distance > 0: travelled = bus.drive(distance) print("{} travelled {}".format(str(bus), travelled)) distance = int(input("Drive how far? ")) taxi = Taxi("Prius 1", 100) print(taxi) taxi.drive(25) print(taxi, taxi.get_fare()) taxi.start_fare() taxi.drive(40) print(taxi, taxi.get_fare()) silver_service_taxi = SilverServiceTaxi("Limo", 100, 2) print(silver_service_taxi, silver_service_taxi.get_fare()) silver_service_taxi.drive(10) print(silver_service_taxi, silver_service_taxi.get_fare())
def cartest(): """Function to test the car and taxi classes""" car = Car("Mazda RX-7 Infini-3", 50) car.drive(10) print("fuel = ", car.fuel) print("odo = ", car.odometer) car.drive(20) print("fuel = ", car.fuel) print("odo = ", car.odometer) print(car) # drive car distance = int(input("Drive how far")) while distance > 0: travelled = car.drive(distance) print("{} travelled {}".format(str(car), travelled)) distance = int(input("Drive how far?")) t = Taxi("Prius 1", 100) print(t) t.drive(25) print(t, t.get_fare()) t.start_fare() t.drive(40) print(t, t.get_fare()) sst = SilverService("Mercedes S500L", 200, 4) print(sst, sst.get_fare()) sst.drive(10) print(sst, sst.get_fare())
def main(): """Test cases for Taxi class""" prius_taxi = Taxi("Prius 1", 100) prius_taxi.drive(20) print(prius_taxi, prius_taxi.get_fare()) prius_taxi.start_fare() prius_taxi.drive(100) print(print(prius_taxi, prius_taxi.get_fare()))
def main(): Prius_1 = Taxi("Prius 1", 100) Prius_1.drive(60) print(Prius_1.__str__()) print(Prius_1.get_fare()) Prius_1.drive(100) print(Prius_1.__str__()) print(Prius_1.get_fare())
def main(): taxi_p = Taxi("Prius 1", 100) taxi_p.drive(40) print(taxi_p) print("The fare is $" + str(taxi_p.get_fare())) taxi_p.start_fare() taxi_p.drive(100) print(taxi_p) print("The fare is $" + str(taxi_p.get_fare()))
def main(): taxi = Taxi("Prius 1", 100) taxi.drive(40) print(taxi) print("Fare: ${:.2f}".format(taxi.get_fare())) taxi.start_fare() taxi.drive(100) print(taxi) print("Fare: ${:.2f}".format(taxi.get_fare()))
def main(): taxi = Taxi("Prius 1", 100) taxi.drive(40) print(taxi.__str__()) print("Taxi's current fare: {}".format(taxi.get_fare())) taxi.start_fare() taxi.drive(100) print("Taxi detail - Name: {}, fuel: {}, price per km: {}".format(taxi.name, taxi.fuel, taxi.price_per_km)) print("Taxi's current fare: {}".format(taxi.get_fare()))
def main(): taxi = Taxi('Prius 1', 100) taxi.drive(40) print(taxi) print('fare = ${}'.format(taxi.get_fare())) taxi.start_fare() taxi.drive(100) print(taxi) print('fare = ${}'.format(taxi.get_fare()))
def main(): """Test the Taxi class.""" prius = Taxi('Prius 1', 100) prius.drive(40) print(prius) print("The current fare is ${:.2f}".format(prius.get_fare())) prius.start_fare() prius.drive(100) print(prius) print("The current fare is ${:.2f}".format(prius.get_fare()))
def main(): my_taxi = Taxi("Prius 1", 100) my_taxi.drive(40) print(my_taxi) print("Current Fare: ${:.2f}".format(my_taxi.get_fare())) my_taxi.start_fare() my_taxi.drive(100) print(my_taxi) print("Current Fare: ${:.2f}".format(my_taxi.get_fare()))
def main(): bill = 0.00 Menu = "q)uit, c)hoose taxi, d)rive" print("Let's drive!") print(Menu) print("Bill to date: ${}".format(bill)) choice = str(input(">>>")) choice.lower() while choice != "q": if choice.lower() == "c": print("Taxis available: ") print( "0 - Prius, fuel=100, odometer=0, 0km on current fare, $1.23/km" "\n" "1 - Limo, fuel=100, odometer=0, 0km on current fare, $2.46/km plus flagfall of $4.50" "\n" "2 - Hummer, fuel=200, odometer=0, 0km on current fare, $4.92/km plus flagfall of $4.50" ) car_choose = int(input("Choose car:")) if car_choose == 0: distance = int(input("Drive how far?")) taxi0 = Taxi("Prius 1", 100) taxi0.drive(distance) print("Bill to date: ${}".format(taxi0.get_fare())) bill += taxi0.get_fare() print(Menu) print("Bill to date: ${}".format(bill)) choice = str(input(">>>")) choice.lower() elif car_choose == 1: distance = int(input("Drive how far?")) taxi1 = Silver_service_taxi("Limo", 100, 2) taxi1.drive(distance) print("Bill to date: ${}".format(taxi1.get_fare())) print(Menu) print("Bill to date: ${}".format(bill)) choice = str(input(">>>")) choice.lower() elif car_choose == 2: distance = int(input("Drive how far?")) taxi2 = Silver_service_taxi("Limo", 100, 2) taxi2.drive(distance) print("Bill to date: ${}".format(taxi2.get_fare())) print(Menu) print("Bill to date: ${}".format(bill)) choice = str(input(">>>")) choice.lower() else: print("Invalid option") print("Bill to date: ${})".format(bill))
def main(): """This program is modified version after Inheriting Enhancements""" taxi = Taxi(100, "Prius 1") taxi.drive(40) print(taxi) print("Fare ={:.2f}".format(taxi.get_fare())) taxi.start_fare() taxi.drive(100) print() print(taxi) print("Fare ={:.2f}".format(taxi.get_fare()))
def main(): """ print taxi information """ prius_taxi = Taxi("Prius 1", 100) prius_taxi.drive(40) # Drive the taxi 40m print(prius_taxi) # print the taxi's current details and the current fare print(" +-- Current fare {:.2f}".format(prius_taxi.get_fare())) prius_taxi.start_fare() # restart the meter (start a new fare) prius_taxi.drive(100) print(prius_taxi) print(" +-- Current fare {:.2f}".format(prius_taxi.get_fare()))
def main(): taxi = Taxi("Prius 1", 100, 1.23) taxi.drive(40) print(taxi) print("The current fare is ", taxi.get_fare()) taxi.drive(100) print(taxi) print("The current fare is ", taxi.get_fare()) print(taxi.price_per_km)
def main(): # Step 1 # taxi1 =Taxi('Prius 1',100,1.20) # Step 5 taxi1 = Taxi('Prius 1',100) # Check # print(taxi1) # Step 2 taxi1.drive(40) print(taxi1) # Step 3 taxi1.odometer = 0 taxi1.drive(100) print(taxi1.get_fare()) # Check # print(taxi1) # step 4 print(taxi1)
def main(): taxi = Taxi("Prius 1", 100) taxi.drive(40) print(taxi) taxi.start_fare() taxi.drive(100) print(taxi.get_fare())
def main(): taxi = Taxi('prius_1', 100) taxi.drive(40) print( 'The, {self.name}, has {self.fuel} litters of fuel'.format(self=taxi), ',Fare Costs ${:.2f}'.format(taxi.get_fare()))
def main(): taxi = Taxi('prius_1', 100) taxi.drive(40) print( 'Expect that Prius 1 has 60 liters of fuel, and fair costs $49.20 - ' 'Got, {self.name}, has {self.fuel} LTRS of fuel'.format(self=taxi), ',Fare Costs ${:.2f}'.format(taxi.get_fare()))
def main(): """test the taxi class""" my_taxi = Taxi("Prius 1", 100) my_taxi.drive(40) print(my_taxi) my_taxi.start_fare() my_taxi.drive(100) print(my_taxi) print("Current fair is: $", my_taxi.get_fare())
def main(): """Test taxi program""" my_taxi = Taxi("Prius 1", 100) my_taxi.drive(40) print(my_taxi.get_fare()) print(my_taxi) print(my_taxi.start_fare()) my_taxi.drive(100) print(my_taxi)
def main(): my_taxi = Taxi("Prius 1", 100) my_taxi.drive(40) print(my_taxi) my_fare = my_taxi.get_fare() print(my_fare) my_taxi.start_fare() my_taxi.drive(100) print(my_taxi)
def main(): name = input("Name: ") fuel = int(input("Fuel: ")) #price_per_km = float(input("Price per km $: ")) taxi1 = Taxi(name, fuel) taxi1.drive(40) print("TEST2", taxi1) current_fare = taxi1.get_fare() print("TEST3", current_fare) taxi1.start_fare() taxi1.drive(100) print("TEST4", taxi1)
from car import Car from taxi import Taxi Prius = Taxi("Prius 1", 100) Prius.drive(40) fare = Prius.get_fare() print(Prius) print(fare) Prius.start_fare() Prius.drive(100) fare = Prius.get_fare() print(Prius) print(fare)
from taxi import Taxi prius = Taxi("Prius 1", 100, 1.20) prius.drive(40) print(prius) print("Current fare is: ${:.2f}".format(prius.get_fare())) prius.start_fare() prius.drive(100) print(prius) print("Current fare is: ${:.2f}".format(prius.get_fare()))
from taxi import Taxi taxi1 = Taxi("Prius 1", 100) assert taxi1.drive(10) print(taxi1) print("Current Fare = ", taxi1.get_fare()) taxi1.start_fare() taxi1.drive(100) print(taxi1, "Current fare is", taxi1.get_fare())
from taxi import Taxi prius = Taxi("Prius1", 100) prius.drive(40) print(prius) print(prius.get_fare()) prius.current_fare_distance = 0 prius.drive(100) print(prius) print(prius.get_fare())