def test():
    # 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(bus)
    #     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())
Esempio n. 2
0
def main():
    my_taxi = Taxi("Prius 1", 100)
    my_taxi.drive(40)
    print(my_taxi)
    my_taxi.start_fare()
    my_taxi.drive(100)
    print(my_taxi)
Esempio n. 3
0
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())
Esempio n. 4
0
def main():
    """Test 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)
Esempio n. 5
0
def main():
    prius_1 = Taxi("Prius 1", 100)
    prius_1.drive(40)
    print(prius_1.__str__())
    print(prius_1.get_fare())

    prius_1.start_fare()
    prius_1.drive(100)
    print(prius_1.__str__())
    print(prius_1.get_fare())
Esempio n. 6
0
def main():
    taxi1 = Taxi("Prius", 100)

    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()))