Example #1
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)

    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 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())
Example #3
0
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())
Example #4
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)
def main():
    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print(taxi)
    taxi.start_fare()
    taxi.drive(100)
    print(taxi)
Example #6
0
def main():
    Taxi.price_per_km=1.2
    taxi1=Taxi("Prius 1", 100, 1.2)
    taxi1.drive(40)
    taxi1.start_fare()
    taxi1.drive(100)
    print(taxi1)
Example #7
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)

    # 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())
Example #8
0
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 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())
Example #10
0
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)
Example #11
0
def taxi_test():
    new_taxi = Taxi("Prius 1", 100)  # new taxi with 100 units of fuel @ $1.23
    new_taxi.drive(40) # drive 40km
    print(new_taxi)
    new_taxi.start_fare() # start new fare
    new_taxi.drive(100) # drive 100km
    print(new_taxi)
Example #12
0
def main():

    prius_taxi = Taxi("Prius 1", 100)
    prius_taxi.drive(40)
    print(prius_taxi)
    prius_taxi.start_fare()
    prius_taxi.drive(100)
    print(prius_taxi)
Example #13
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)
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()))
Example #15
0
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():
    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()))
Example #17
0
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():
    """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())
Example #19
0
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():
    """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()))
Example #21
0
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()))
Example #22
0
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()))
Example #23
0
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()))
Example #24
0
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)
Example #25
0
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)
from taxi import Taxi

prius_1 = Taxi("Prius_1", 100)
print(prius_1)
prius_1.drive(40)
print(prius_1)
prius_1.start_fare()
prius_1.drive(100)
print(prius_1)
Example #27
0
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()))
def main():
    prius = Taxi('Prius I', 100)
    prius.drive(40)
    print(prius)
    prius.start_fare()
    print(prius.get_fare())
Example #29
0
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()))

Example #30
0
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)
Example #31
0
from taxi import Taxi
from taxi2 import Taxi2

taxi1 = Taxi("prius 1", 100, 1.23)
taxi1.drive(40)
print(taxi1)
taxi1.start_fare()
taxi1.drive(100)
print(taxi1)

taxi1 = Taxi2("prius 1", 100)
taxi1.drive(40)
print(taxi1)
taxi1.start_fare()
taxi1.drive(100)
print(taxi1)