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)

    # 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 tests():
    car = Car("Datsun", 180)
    car.drive(30)
    print("fuel =", car.fuel)
    print("odo =", car.odometer)
    car.drive(55)
    print("fuel =", car.fuel)
    print("odo = ", car.odometer)
    print(car)

    distance = int(input("Drive how far? "))
    while distance > 0:
        travel = car.drive(distance)
        print("{} travelled {}".format(str(car), travel))
        distance = int(input("Drive how far? "))

    taxis = Taxi("Prius 1", 100)
    taxis.drive(25)
    print(taxis)
    print(taxis, taxis.get_fare())
    taxis.start_fare()
    taxis.drive(40)
    print(taxis, taxis.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())
Exemple #3
0
def main():
    my_taxi = Taxi("Prius 01", 100)
    my_taxi.drive(40)
    print(my_taxi, "${:.2f}".format(my_taxi.get_fare()))
    my_taxi.start_fare()
    my_taxi.drive(100)
    print(my_taxi, "${:.2f}".format(my_taxi.get_fare()))
Exemple #4
0
def main():
    new_taxi = Taxi("Prius 1", 100)
    new_taxi.drive(40)
    print(new_taxi, new_taxi.get_fare())
    new_taxi.start_fare()
    new_taxi.drive(100)
    print(new_taxi, new_taxi.get_fare())
Exemple #5
0
def main():
    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print("{}, Fare: ${}".format(taxi, taxi.get_fare()))
    taxi.start_fare()
    taxi.drive(100)
    print("{}, Fare: ${}".format(taxi, taxi.get_fare()))
Exemple #6
0
def run_tests():
    """Run tests to show workings of Car and Taxi classes."""
    test_bus = Car("Test Bus", 200)
    test_bus.drive(30)
    print("fuel =", test_bus.fuel)
    print("odo =", test_bus.odometer)
    test_bus.drive(60)
    print("fuel =", test_bus.fuel)
    print("odo = ", test_bus.odometer)
    print(test_bus)

    # Drive a bus
    print("Enter driving distance:")
    distance = int(input(">> "))
    while distance > 0:
        distance_travelled = test_bus.drive(distance)
        print("{} has travelled {} km.".format(test_bus, distance_travelled))
        print("Enter driving distance (km):")
        distance = int(input(">> "))

    test_taxi = Taxi("Test Taxi", 100)
    print(test_taxi)
    test_taxi.drive(30)
    print(test_taxi, test_taxi.get_fare())
    test_taxi.start_fare()
    test_taxi.drive(60)
    print(test_taxi, test_taxi.get_fare())

    fancy_taxi = Taxi("Test Fancy Taxi", 100, 2)
    print(fancy_taxi)
    fancy_taxi.drive(30)
    print(fancy_taxi, fancy_taxi.get_fare())
Exemple #7
0
def main():
    # 1 - Create a new taxi with name "Prius 1", 100 units of fuel and price of $1.23/km

    new_taxi = Taxi("Prius 1", 100)
    print(new_taxi)

    # 2 - Drive the taxi 40km
    new_taxi.drive(40)
    print(new_taxi)

    # 3 - Print the taxi's details and the current fare

    print(new_taxi)
    print("name:", new_taxi.name)
    print("fuel", new_taxi.fuel)
    print("odometer", new_taxi.odometer)
    print("fare distance", new_taxi.current_fare_distance)
    print("fare $", new_taxi.price_per_km, "per/km")
    print("current fare: $", new_taxi.get_fare())

    # 4 - Restart the meter (start a new fare) and then drive the car 100km

    new_taxi.start_fare()
    # can only drive 60k due to fuel left
    new_taxi.drive(100)
    print(new_taxi)

    # 5 - Print the details and the current fare
    print(new_taxi)
    print("current fare: $", new_taxi.get_fare())

    # test class variable
    print(new_taxi.price_per_km)
def main():
    prius = Taxi("Prius 1", 100)
    prius.drive(40)
    print("{}, (${})".format(prius.__str__(), prius.get_fare()))
    prius.start_fare()
    prius.drive(100)
    print("{}, (${})".format(prius.__str__(), prius.get_fare()))
Exemple #9
0
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? "))

    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())
Exemple #10
0
def main():
    """Test taxi class"""
    my_taxi = Taxi("Prius 1", 100)
    my_taxi.drive(40)
    print("{}, Current fare: ${}".format(my_taxi, my_taxi.get_fare()))
    my_taxi.start_fare()
    my_taxi.drive(100)
    print("{}, Current fare: ${}".format(my_taxi, my_taxi.get_fare()))
def main():
    """Demo test code to show how to use car class."""
    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print("{}\n${}".format(taxi, taxi.get_fare()))
    taxi.start_fare()
    taxi.drive(100)
    print("${}".format(taxi.get_fare()))
def main():
    new_taxi = Taxi("Prius 1", 100)
    new_taxi.drive(40)
    current_fare = new_taxi.get_fare()
    print("{}, ${}".format(new_taxi, current_fare))
    new_taxi.start_fare()
    current_fare = new_taxi.get_fare()
    print("{}, ${}".format(new_taxi, current_fare))
Exemple #13
0
def main():
    """Test the taxi and car classes."""
    taxi = Taxi('Prius 1', 100)
    taxi.drive(40)
    print("{} Total: ${:.2f}".format(taxi, taxi.get_fare()))
    taxi.start_fare()
    taxi.drive(100)
    print("{} Total: ${:.2f}".format(taxi, taxi.get_fare()))
Exemple #14
0
def main():
    my_taxi = Taxi("Prius 1", 100)
    my_taxi.drive(40)
    print(my_taxi)
    print(my_taxi.get_fare())
    my_taxi.start_fare()
    my_taxi.drive(100)
    print(my_taxi)
    print(my_taxi.get_fare())
def main():
    prius_1 = Taxi('Prius 1', 100)
    prius_1.drive(40)
    print(prius_1)
    print("Current Fare: ${:.2f}".format(prius_1.get_fare()))
    prius_1.start_fare()
    prius_1.drive(100)
    print(prius_1)
    print("Current Fare: ${:.2f}".format(prius_1.get_fare()))
Exemple #16
0
def main():
    taxi1 = Taxi('Prius 1', 100)
    taxi1.drive(40)
    print(taxi1)
    print("${}".format(taxi1.get_fare()))
    taxi1.start_fare()
    taxi1.drive(100)
    print(taxi1)
    print("${}".format(taxi1.get_fare()))
Exemple #17
0
def main():
    my_taxi = Taxi('Prius 1', 100)
    my_taxi.drive(40)
    print(my_taxi)
    print('Current fare cost is', my_taxi.get_fare())
    my_taxi.start_fare()
    my_taxi.drive(100)
    print(my_taxi)
    print('Current fare cost is', my_taxi.get_fare())
Exemple #18
0
def main():
    """Test for the Taxi class"""
    prius = Taxi("Prius 1", 100)
    prius.drive(40)
    print(prius)
    print("Fare = $", prius.get_fare())
    prius.start_fare()
    print(prius)
    print("Fare = $", prius.get_fare())
Exemple #19
0
def main():
    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print(taxi)
    print(taxi.get_fare())
    taxi.start_fare()
    taxi.drive(100)
    print(taxi)
    print(taxi.get_fare())
def main():
    new_taxi = Taxi('Prius 1', 100)
    new_taxi.drive(40)
    print(new_taxi)
    print('Current Fare:', new_taxi.get_fare())
    new_taxi.start_fare()
    new_taxi.drive(100)
    print(new_taxi)
    print('Current Fare:', new_taxi.get_fare())
def main():
    print("Taxi Testing")
    new_taxi = Taxi("Prius 1", 100)
    new_taxi.drive(40)
    print(new_taxi)
    print("The price of that trip was {}".format(new_taxi.get_fare()))
    new_taxi.start_fare()
    new_taxi.drive(100)
    print(new_taxi)
    print("The price of that trip was {}".format(new_taxi.get_fare()))
Exemple #22
0
def main():
    prius = Taxi("Prius 1", 100)
    prius.drive(40)
    print(prius)
    print("Current fare: ${}".format(prius.get_fare()))

    prius.start_fare()
    prius.drive(100)
    print(prius)
    print("Current fare: ${}".format(prius.get_fare()))
Exemple #23
0
def main():
    taxi = Taxi("Prius 1", 100)
    print(taxi)
    taxi.drive(40)
    print(taxi)
    print("Current fare ${:.2f}".format(taxi.get_fare()))
    taxi.start_fare()
    taxi.drive(100)
    print(taxi)
    print("Current fare ${:.2f}".format(taxi.get_fare()))
def main():

    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print("taxi name =", taxi.name)
    print("current fare = $", taxi.get_fare())
    taxi.start_fare()
    taxi.drive(100)
    print("taxi name =", taxi.name)
    print("current fare = $", taxi.get_fare())
Exemple #25
0
def main():
    taxi1 = Taxi("Prius 1", 100, 1.23)

    taxi1.drive(40)
    print(taxi1)
    print("The current fare is ${}".format(taxi1.get_fare()))
    taxi1.start_fare()
    taxi1.drive(100)
    print(taxi1)
    print("The current fare is ${}".format(taxi1.get_fare()))
Exemple #26
0
def main():
    """Code to test out taxi class"""
    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print(taxi)
    print("Fare: $" + str(taxi.get_fare()))
    taxi.start_fare()
    taxi.drive(100)
    print(taxi)
    print("Fare: $" + str(taxi.get_fare()))
def main():
    prius = Taxi("Prius 1", 100)
    prius.drive(40)
    print(prius)
    print(prius.get_fare())

    prius.start_fare()
    prius.drive(100)
    print(prius)
    print(prius.get_fare())
def main():
    """Test code for Taxi class."""
    my_taxi = Taxi("Prius 1", 100)
    my_taxi.drive(40)
    print("fuel =", my_taxi.fuel)
    print("odo =", my_taxi.odometer)
    print("Fare = ${:.2f}".format(my_taxi.get_fare()))
    my_taxi.start_fare()
    my_taxi.drive(100)
    print(my_taxi)
    print("Fare = ${:.2f}".format(my_taxi.get_fare()))
Exemple #29
0
def main():
    """Test the Taxi class"""
    new_taxi = Taxi("Prius 1", 100)
    new_taxi.drive(40)
    print(new_taxi)
    print(new_taxi.get_fare())

    new_taxi.start_fare()
    new_taxi.drive(100)
    print(new_taxi)
    print(new_taxi.get_fare())
Exemple #30
0
def main():
    """Test Taxi."""
    prius_1 = Taxi("Prius 1", 100)
    prius_1.drive(40)
    print(prius_1)
    print("Current fare is ${}".format(prius_1.get_fare()))

    prius_1.start_fare()
    prius_1.drive(100)
    print(prius_1)
    print("Current fare is ${}".format(prius_1.get_fare()))