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 = SliverServiceTaxi("Limo", 100, 2)
    print(sst, sst.get_fare())
    sst.drive(10)
    print(sst, sst.get_fare())
Пример #2
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())
Пример #3
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()))
Пример #4
0
def main():
    my_taxi = Taxi("Prius 1", 100, 1.23)
    my_taxi.drive(40)
    print(my_taxi)
    print(my_taxi.get_fare())
    taxi = Taxi("Prius 1", 100, 1.23)
    taxi.drive(100)
    print(my_taxi.start_fare())
    print(taxi.get_fare())
Пример #5
0
def main():
    prius = Taxi('Prius', 100)
    prius.drive(40)
    print(prius)
    print("The current fair is ${}".format(prius.get_fare()))
    prius.start_fare()
    prius.drive(100)
    print(prius)
    print("The current fair is ${}".format(prius.get_fare()))
Пример #6
0
def main():
    my_taxi = Taxi("Prius 1", 100)
    my_taxi.drive(40)
    print("Taxi name: {}, Current Fuel {} and Current Fare is ${}".format(
        my_taxi.name, my_taxi.fuel, my_taxi.get_fare()))

    my_taxi.start_fare()
    my_taxi.drive(100)
    print("Taxi name: {}, Current Fuel {} and Current Fare is ${}".format(
        my_taxi.name, my_taxi.fuel, my_taxi.get_fare()))
Пример #7
0
def main():
    my_taxi = Taxi('Prius 1', 100)
    my_taxi.drive(40)
    print("Taxi = {}".format(my_taxi.name))
    print("Current fare = ${:.2f}".format(my_taxi.get_fare()))
    my_taxi.start_fare()
    my_taxi.drive(100)
    print("Taxi = {}".format(my_taxi.name))
    print("Current fare = ${:.2f}".format(my_taxi.get_fare()))
    print(Taxi.price_per_km)
Пример #8
0
def main():
    """Test Taxi class."""
    my_taxi = Taxi("Prius", 100)
    my_taxi.drive(40)
    print(my_taxi)
    my_taxi.start_fare()
    my_taxi.drive(40)
    print(my_taxi)
    print("Total cost of trip ${:.2f}".format(my_taxi.get_fare()))
Пример #9
0
from Prac_08.taxi import Taxi

taxi_1 = Taxi("Prius 1", 100)
taxi_1.drive(40)
print(taxi_1)
print("Fare = ${}".format(taxi_1.get_fare()))
taxi_1.start_fare()
taxi_1.drive(100)
print(taxi_1)
print("Fare = ${}".format(taxi_1.get_fare()))
Пример #10
0
from Prac_08.taxi import Taxi

new_taxi = Taxi("Pruis 1", 100)

new_taxi.drive(40)

print(new_taxi.__str__(), new_taxi.get_fare())

new_taxi.start_fare()
new_taxi.drive(100)
print(new_taxi.__str__(), new_taxi.get_fare())

Пример #11
0
from Prac_08.taxi import Taxi

NewTaxi = Taxi("Prius1", 100)
NewTaxi.drive(20)
print(NewTaxi)
print(NewTaxi.get_fare())
NewTaxi.start_fare()
NewTaxi.drive(40)
print(NewTaxi)
print(NewTaxi.get_fare())
Пример #12
0
from Prac_08.taxi import Taxi


new_taxi = Taxi("Prius 1", 100)
new_taxi.drive(40)
print(new_taxi)
print("Fare for the trip: $", new_taxi.get_fare())
new_taxi.start_fare()
new_taxi.drive(100)
print(new_taxi)
print("Fare for the trip: $", new_taxi.get_fare())
Пример #13
0
from Prac_08.taxi import Taxi

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