def main():
    total_bill = 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: ")
            display_taxis(taxis)
            # no error-checking
            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)
Exemple #2
0
def main():
    print("Let's drive!")
    taxis = [
        Taxi("Prius", 100),
        SilverServiceTaxi("Limo", 100, 2),
        SilverServiceTaxi("Hummer", 200, 4)
    ]
    bill_to_date = 0.0
    taxi = 0
    menu_choice = input(MENU).lower()
    while menu_choice != "q":
        if menu_choice == "c":
            print("Taxis available:")
            for i in range(len(taxis)):
                print(i, "-", taxis[i])
            taxi = int(input("Choose taxi: "))
        elif menu_choice == "d":
            distance = int(input("Drive how far?"))
            taxis[taxi].drive(distance)
            fare = taxis[taxi].get_fare()
            bill_to_date += fare
            print("Your {} trip cost you ${:.2f}".format(
                taxis[taxi].name, fare))
            taxis[taxi].start_fare()
        else:
            print("Invalid menu choice!")
        print("Bill to date: ${0:.2f}".format(bill_to_date))
        menu_choice = input(MENU).lower()

    print("Total trip cost: ${:.2f}".format(bill_to_date))
    print("Taxis are now:")
    for i in range(len(taxis)):
        print(i, "-", taxis[i])
def main():

    taxis = [
        Taxi("Prius", 100),
        SilverServiceTaxi("Limo", 100, 2),
        SilverServiceTaxi("Hummer", 200, 4)
    ]

    current_bill = 0
    total_bill = 0
    current_taxi = ""

    print("Let's drive!")
    menu_option = input("q)uit, c)hoose, d)rive\n>>>").lower()
    while menu_option != 'q':
        if menu_option == 'c':
            display_taxi(taxis)
            chosen_taxi = int(input("Choose taxi: "))
            current_taxi = taxis[chosen_taxi]
            # print(current_taxi)#
            display_bill(total_bill, current_bill)
            menu_option = input("q)uit, c)hoose, d)rive\n>>>").lower()
        if menu_option == 'd':
            travel_distance = int(input("Drive how far?"))
            current_taxi.start_fare()
            current_taxi.drive(travel_distance)
            print("Your {} trip cost you ${:.2f}".format(
                current_taxi.name, current_taxi.get_fare()))
            total_bill += current_taxi.get_fare()
            display_bill(total_bill, current_bill)
            menu_option = input("q)uit, c)hoose, d)rive\n>>>").lower()
Exemple #4
0
def main():
    taxis = [
        Taxi("Prius", 100),
        SilverServiceTaxi("Limo", 100, 2),
        SilverServiceTaxi("Hummer", 200, 4)
    ]
    total_bill = 0

    print("Let's drive!")
    print(MENU_STRING)
    choice = input(">>> ").upper()
    while choice != "Q":
        if choice == "C":
            print("Taxis available:")
            display_taxis(taxis)
            taxi_choice = int(input("Choose taxi: "))
            current_taxi = taxis[taxi_choice]
        elif 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 Choice")
        print(MENU_STRING)
        choice = input(">>> ").upper()

    print("Total trip cost: ${:.2f}".format(total_bill))
    print("Taxis are now:")
    display_taxis(taxis)
def main():
    finished = False
    chosen = False
    fare = 0
    taxis = [
        Taxi(100, "Prius"),
        SilverServiceTaxi(100, "Limo", 2),
        SilverServiceTaxi(200, "Hummer", 4)
    ]
    chosen_ride = input("Prius, Limo, Hummer\nChoose your ride(p,l,h):")
    while not finished:
        while not chosen:
            if chosen_ride == "p":
                taxi = taxis[0]
                distance = int(input("how far will you drive? "))
                taxi.drive(distance)
                print(taxi)
                chosen = True
            elif chosen_ride == "l":
                taxi = taxis[1]
                distance = int(input("how far will you drive? "))
                taxi.drive(distance)
                print(taxi)
                chosen = True
            elif chosen_ride == "h":
                taxi = taxis[2]
                distance = int(input("how far will you drive? "))
                taxi.drive(distance)
                print(taxi)
                chosen = True
            else:
                print("invalid ride")
                chosen_ride = input(
                    "Prius, Limo, Hummer\nChoose your ride(p,l,h):")
        fare += taxi.get_fare()
        print("current bill at ${:.2f}".format(fare))

        y_n = input("would you like to drive again (y/n)? ")
        answer = False
        while not answer:
            if y_n == "y":
                chosen_ride = input(
                    "Prius, Limo, Hummer\nChoose your ride(p,l,h):")
                chosen = False
                answer = True
            elif y_n == "n":
                finished = True
                answer = True
            else:
                print("invalid answer")
                answer = False
    print("final Bill: ${:.2f}".format(fare))
def main():
    my_silverservice = SilverServiceTaxi('Hummer', 200, 4)
    print(my_silverservice)
    my_silverservice.start_fare()
    my_silverservice.drive(100)
    print(my_silverservice.get_fare())
    print(my_silverservice)

    test_silverservice = SilverServiceTaxi('Lotus', 100, 2)
    print(test_silverservice)
    test_silverservice.start_fare()
    test_silverservice.drive(18)
    print(test_silverservice.get_fare())
    print(test_silverservice)
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 #8
0
def main():
    silvertaxi = SilverServiceTaxi("SST1", 200, 2)
    print(silvertaxi)

    silvertaxi.drive(18)
    print(silvertaxi)
    print("The current fare is {:.2f}".format(silvertaxi.get_fare()))
    silvertaxi.start_fare()
Exemple #9
0
def main():
    total_fare_price = 0
    taxis = [
        Taxi("Pruis", 100),
        SilverServiceTaxi("limo", 100, 2),
        SilverServiceTaxi("Hummer", 200, 4)
    ]
    print("Let's drive!")
    print(MENU)
    current_taxi = None
    menu_input = input(">>> ").lower()
    while menu_input != "q":
        if menu_input == "c":
            print("Taxis available: ")
            print_taxis(taxis)
            valid_taxi_number = False
            while not valid_taxi_number:
                try:
                    taxi_choice = int(input("Choose Taxi: "))
                    if taxi_choice > len(taxis) - 1:
                        taxi_choice = int(input("Choose Taxi: "))
                    else:
                        valid_taxi_number = True
                except ValueError:
                    print("Invalid Number")
            print("Bill to date: ${:.2f}".format(total_fare_price))
            current_taxi = taxis[taxi_choice]
        elif menu_input == "d":
            if current_taxi is not None:
                current_taxi.start_fare()
                drive_distance = float(input("Drive how far? "))
                current_taxi.drive(drive_distance)
                trip_price = current_taxi.get_fare()
                print("Your {} trip cost you {}".format(
                    current_taxi.name, current_taxi.get_fare()))
                total_fare_price += trip_price
        else:
            print("Invalid Option")
        print("Bill to date: ${:.2f}".format(total_fare_price))
        print(MENU)
        menu_input = input(">>> ").lower()

    print("Total trip cost: ${:.2f}".format(total_fare_price))
    print_taxis("Taxis are now:")
    print_taxis(taxis)
def main():
    # car_type = input("Car Type")
    # car_fuel = int(input("How Much Fuel Do We Have?"))
    # car_fanciness = int(input("How Fancy is the car?"))
    # taxi = SilverServiceTaxi(car_type, car_fuel, car_fanciness)
    taxi = SilverServiceTaxi("Hummer", 100, 2)
    taxi.drive(18)
    print(taxi)
    print(taxi.get_fare())
Exemple #11
0
def main():
    """Test taxi (car subclass) features"""

    new_fancy_taxi = SilverServiceTaxi("Hummer", 100, 2)
    new_fancy_taxi.drive(18)
    print(new_fancy_taxi.get_fare())
    print(new_fancy_taxi)
    new_fancy_taxi.start_fare()
    new_fancy_taxi.drive(100)
    print(new_fancy_taxi)
Exemple #12
0
def main():
    """Build list of taxi objects to choose from and simulate drive and billing"""
    print("Lets Drive! ")
    current_taxi = None
    taxis = [
        Taxi("Prius", 100),
        SilverServiceTaxi("Limo", 100, 2),
        SilverServiceTaxi("Hummer", 200, 4)
    ]
    total_trip_cost = 0

    menu_choice = get_menu_choice()
    while menu_choice != "q":

        if menu_choice == "c":
            # list taxis
            print_taxis(taxis)
            taxi_number = get_taxi_choice(taxis)
            current_taxi = assign_taxi(taxi_number, taxis)
            print("Bill to date: ${}".format(total_trip_cost))
            menu_choice = get_menu_choice()
        elif menu_choice == "d":
            # drive taxi
            if current_taxi == None:
                print("You must choose a taxi first! ")
                menu_choice = get_menu_choice()
            else:
                print("Drive how far? ")
                desired_drive_distance = get_int_entry()
                current_taxi.drive(desired_drive_distance)
                total_trip_cost = total_trip_cost + current_taxi.get_fare()
                print("Your {} trip cost you: ${} ".format(
                    current_taxi.name, current_taxi.get_fare()))
                print("Bill to date: {} ".format(total_trip_cost))
                menu_choice = get_menu_choice()
        else:
            print("Invalid menu choice please try again")
            menu_choice = get_menu_choice()
    # print total trip cost
    print("Total trip cost: ${} ".format(total_trip_cost))
    # re-print taxis with changed conditions
    print("Taxis are now: \n")
    print_taxis(taxis)
def main():
    bill = 0
    taxis = [
        Taxi("Prius", 100),
        SilverServiceTaxi("Limo", 100, 2),
        SilverServiceTaxi("Hummer", 200, 4)
    ]
    selected_taxi = None
    print("Let's drive!")
    print(MENU)
    menu_choice = input(">>> ").lower()
    while menu_choice != "q":
        if menu_choice == "c":
            print("Taxis available:")
            print(list_taxis(taxis))
            choose_taxi = int(input("Choose taxi: "))
            while choose_taxi > len(taxis) - 1:
                choose_taxi = int(input("Choose taxi: "))
            selected_taxi = taxis[choose_taxi]

        elif menu_choice == "d":
            if selected_taxi is not None:
                selected_taxi.start_fare()
                distance = int(input("Drive how far? "))
                selected_taxi.drive(distance)
                cost = selected_taxi.get_fare()
                print("Your {} trip cost you ${}".format(
                    selected_taxi.name, cost))
                bill += cost
        else:
            print("Invalid option")
        print("Bill choose to date: ${}".format(bill))
        print(MENU)
        menu_choice = input(">>> ").lower()

    print("Total trip cost: ${}".format(bill))
    print("Taxis are now:")
    list_taxis(taxis)
Exemple #14
0
def main():
    bill = 0
    all_taxis = [Taxi("Prius", 100), SilverServiceTaxi("Limo", 100, 2), SilverServiceTaxi("Hummer", 200, 4)]

    print("Let's Drive!")
    menu_choice = input("q)uit, c)hoose taxi, d)rive \n >>>")
    while menu_choice != "q":
        if menu_choice == "c":
            print("Taxi's available:")
            taxi_display(all_taxis)
            taxi_choice = int(input("Choose taxi: "))
            final_taxi = all_taxis[taxi_choice]
            print(bill)
        elif menu_choice == "d":
            final_taxi.start_fare()
            distance = int(input("Drive how far? \n >>>"))
            final_taxi.drive(distance)
            cost = final_taxi.get_fare()
            print("Your {} trip cost you ${:.2f}".format(final_taxi.name, cost))
            bill += cost
            print("Bill to date: {}".format(bill))
        else:
            print("Total trip cost: {}".format(bill))
Exemple #15
0
def main():
    my_taxi = SilverServiceTaxi("Hummer", 200, 4)
    my_taxi.drive(49)
    print(my_taxi)
    print("${}".format(my_taxi.get_fare()))
Exemple #16
0
from Prac_08.silver_service_taxi import SilverServiceTaxi

new_ride = SilverServiceTaxi("Hummer", 100, 2)
new_ride.start_fare()
new_ride.drive(18)
new_ride.get_fare()
print(new_ride.__str__())
print(new_ride.get_fare())
def main():
    taxi = SilverServiceTaxi("Silver Service Taxi", 100, 2)
    taxi.drive(18)
    print(taxi)
    print(taxi.get_fare())
Exemple #18
0
from Prac_08.silver_service_taxi import SilverServiceTaxi

taxi_1 = SilverServiceTaxi("Hummer", 200, 4)
print(taxi_1)
taxi_2 = SilverServiceTaxi("My Taxi", 1000, 2)
print(taxi_2.drive(18))
print("Fare = ${:.2f}".format(taxi_2.get_fare()))
Exemple #19
0
from Prac_08.car import Car
from Prac_08.taxi import Taxi
from Prac_08.silver_service_taxi import SilverServiceTaxi

MENU = "q)uite, c)hoose taxi, d)rive"
taxis = [
    Taxi("Prius", 100),
    SilverServiceTaxi("Limo", 100, 2),
    SilverServiceTaxi("Hummer", 200, 4)
]


def main():
    total_cost = 0

    print(MENU)
    menu_choice = input(">>> ").lower()
    while menu_choice != "q":
        if menu_choice == "c":
            display_taxi(taxis)
            taxi_choice = int(input("Choose taxi: "))
            current_taxi = taxis[taxi_choice]
        elif menu_choice == "d":
            current_taxi.start_fare()
            km_driven = int(input("Drive how far? "))
            current_taxi.drive(km_driven)
            trip_cost = current_taxi.get_fare()
            total_cost += trip_cost
            print("Your {} trip cost you ${:.2f}".format(
                current_taxi.name, trip_cost))
        else:
Exemple #20
0
from Prac_08.taxi import Taxi
from Prac_08.silver_service_taxi import SilverServiceTaxi

MENU = "q)uit, c)hoose taxi, d)rive"

taxis = [Taxi("Prius", 100), SilverServiceTaxi("Limo", 100, 2), SilverServiceTaxi("Hummer", 200, 4)]
current_taxi = None
bill = 0.0

print("Let's drive!")
print(MENU)
user_choice = input(">>> ").lower()
while user_choice != "q":
    if user_choice == "c":
        print("Taxis available:")
        for index, taxi in enumerate(taxis):
            print("{} - {}".format(index, taxi))

        taxi_choice = int(input("Choose taxi: "))
        current_taxi = taxis[taxi_choice]
    elif user_choice == "d":
        if current_taxi is None:
            print("Choose a taxi first")
        else:
            current_taxi.start_fare()
            distance = float(input("Drive how far? "))
            current_taxi.drive(distance)
            new_bill = current_taxi.get_fare()
            print("Your {} trip cost you ${:.2f}".format(current_taxi.name, new_bill))
            bill += new_bill
    else:
def main():
    limo_taxi = SilverServiceTaxi('Limo', 200, 2)
    print(limo_taxi)
    limo_taxi.drive(18)
    print(limo_taxi)
    print("Current Fare: $", limo_taxi.get_fare())
from Prac_08.silver_service_taxi import SilverServiceTaxi

new_taxi = SilverServiceTaxi("Hummer", 50, 2)
new_taxi.drive(55)
print(new_taxi, new_taxi.get_fare())


from Prac_08.silver_service_taxi import SilverServiceTaxi

new_silver_taxi = SilverServiceTaxi("Silver Boi", 100, 2)
new_silver_taxi.drive(18)
print(new_silver_taxi)
print(new_silver_taxi.get_fare())
Exemple #24
0
def main():
    """Test SilverServiceTaxi."""
    taxi = SilverServiceTaxi("Taxi F", 100, 3)
    taxi.drive(50)
    print(taxi)
    print("The total fare is $", taxi.get_fare())
Exemple #25
0
from Prac_08.silver_service_taxi import SilverServiceTaxi

# For an 18km trip in a SilverServiceTaxi with fanciness of 2, the fare should be $48.78 (yikes!)

premium_taxi = SilverServiceTaxi("Premium Taxi", 200, 2)
print(premium_taxi)
premium_taxi.drive(18)
print(premium_taxi.get_fare())
print(premium_taxi)
Exemple #26
0
def main():
    """Test SilverServiceTaxi."""
    taxi = SilverServiceTaxi("Test Fancy Taxi", 100, 2)
    taxi.drive(18)
    print(taxi)
    print(taxi.get_fare())
Exemple #27
0
def main():
    silver_taxi = SilverServiceTaxi(100, "Silver", 2)
    print(silver_taxi)
    silver_taxi.drive(18)
    print(silver_taxi)