Example #1
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 #2
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())
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())
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 #5
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 #6
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 #8
0
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():
    """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 #10
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()))
Example #11
0
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())
Example #12
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()))
Example #13
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()))
Example #14
0
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."""
    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 #16
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 #17
0
def main():
    taxi = Taxi("Prius 1", 100)
    taxi.drive(40)
    print(taxi)

    taxi.start_fare()
    taxi.drive(100)
    print(taxi.get_fare())
Example #18
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()))
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 #20
0
def main():
    test_taxi = Taxi("Yellow Cab", "NYC1", 2005, 4, 2)
    print(test_taxi.getmake())
    print(test_taxi.getmodel())
    print(test_taxi.getyear())
    print(test_taxi.getriders())
    print(test_taxi.getmeter())

    test_taxi.soundhorn()
Example #21
0
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)
Example #22
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 #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 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 #25
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)
Example #26
0
def main():
    taxi = Taxi('Prius 1', 100)
    taxi.drive(40)
    print(taxi)

    taxi.start_fare()
    taxi.drive(100)
    print(taxi)
Example #27
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)
def main():
    # total bill
    total_cost = 0
    # Generate three cars
    cars = [Taxi("Prius", 100), SilverServiceTaxi("Limo", 100, 2), SilverServiceTaxi("Hummer", 200, 4)]
    # Current operate car
    cur_car = None
    print("Let's drive!")
    user_select = get_user_select()
    while user_select != "q":
        if user_select == "c":
            # Choose a car
            cur_car = get_choose_car(cars)
        elif user_select == "d":
            # Drive a car
            if cur_car is None:
                print("You should choose a taxi first!")
            else:
                cur_car.start_fare()
                distance_to_drive = float(input("Drive how far? "))
                cur_car.drive(distance_to_drive)
                trip_cost = cur_car.get_fare()
                print("Your {} trip cost you ${:.2f}".format(cur_car.name, trip_cost))
                total_cost += trip_cost
        print("Bill to date: ${:.2f}".format(total_cost))
        user_select = get_user_select()

    print("Total trip cost: ${:.2f}".format(total_cost))
    print("Taxis are now:")
    show_cars(cars)
Example #29
0
def main():
    bill_total = 0
    taxis = [Taxi("Prius", 100), SilverServiceTaxi("Limo", 100, 2), SilverServiceTaxi("Hummer", 200, 4)]

    print("Let's Drive!")
    print(menu)
    menu_choice = input(">>> ").lower()
    while menu_choice != "q":
        if menu_choice == "c":
            print("Taxis available:")
            taxi_display(taxis)
            taxi_chosen = int(input("Choose taxi:"))
            used_taxi = taxis[taxi_chosen]
        elif menu_choice == "d":
            used_taxi.start_fare()
            distance_to_drive = float(input("Drive how far? "))
            used_taxi.drive(distance_to_drive)
            cost = used_taxi.get_fare()
            print("Your {} trip cost you ${:.2f}".format(used_taxi.name, cost))
            bill_total += cost
        else:
            print("Invalid option")
        print("Bill to date: ${:.2f}".format(bill_total))
        print(menu)
        menu_choice = input(">>> ").lower()
    print("Total trip cost: ${:.2f}".format(bill_total))
    print("Taxis are now:")
    display_taxis(taxis)
def main():
    total_bill = 0
    taxis = [
        Taxi("testtaxi", 100),
        silverservice("testsilverlimo", 100, 2),
        silverservice("testbiglimo", 200, 4)
    ]

    print("Let's drive!")
    print(MENU)
    menu_choice = input(">>> ").lower()
    while menu_choice != "q":
        if menu_choice == "c":
            print("Taxis available: ")
            display_taxis(taxis)
            taxi_choice = int(input("Choose taxi: "))
            current_taxi = taxis[taxi_choice]
        elif menu_choice == "d":
            current_taxi.start_fare()
            distance_to_drive = float(input("Drive how far? "))
            current_taxi.drive(distance_to_drive)
            trip_cost = current_taxi.get_fare()
            print("Your {} trip cost you ${:.2f}".format(
                current_taxi.name, trip_cost))
            total_bill += trip_cost
        else:
            print("Invalid option")
        print("Bill to date: ${:.2f}".format(total_bill))
        print(MENU)
        menu_choice = input(">>> ").lower()

    print("Total trip cost: ${:.2f}".format(total_bill))
    print("Taxis are now:")
    display_taxis(taxis)
Example #31
0
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)
Example #32
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()))