def main():

    my_car = UnreliableCar("Hex", 50, 60)
    for i in range(1, 6):
        print("Attempting to drive {} km".format(i))
        print("{} drove {} km".format(my_car, my_car.drive(i)))
    print(my_car)
Ejemplo n.º 2
0
def main():
    unreliablecar = UnreliableCar('car', 500, 50)
    time = int(input('Enter the time you want to test: '))
    for i in range(time):
        print('{} drives {}km'.format(unreliablecar.name,
                                      unreliablecar.drive(10)))
    print(unreliablecar)
def main():
    uc = UnreliableCar("Unreliable Car", 100, 50)

    for i in range(10):
        print("The car wants to drive 10km")
        print("{} drives {}km.".format(uc.name, uc.drive(10)))
        print()

    print(uc)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
def main():
    """Test some UnreliableCars."""

    # cars with different reliabilities

    good_car = UnreliableCar("Mostly Good", 100, 90)

    bad_car = UnreliableCar("Dodgy", 100, 9)

    # attempt to drive the cars many times

    # output based on the driven distance

    for i in range(1, 12):

        print("Attempting to drive {}km:".format(i))

        print("{:12} drove {:2}km".format(good_car.name, good_car.drive(i)))

        print("{:12} drove {:2}km".format(bad_car.name, bad_car.drive(i)))

    # Final stage of car

    print(good_car)

    print(bad_car)
Ejemplo n.º 6
0
def main():
    good_car = UnreliableCar("good car", 100, 80)
    bad_car = UnreliableCar("bad car", 100, 10)

    for i in range(10):
        print("try to drive {} km".format(i))
        print("{:10} drove {:2}km".format(good_car.name, good_car.drive(i)))
        print("{:10} drove {:2}km".format(bad_car.name, bad_car.drive(i)))
    print(good_car)
    print(bad_car)
def test():
    bad_car = UnreliableCar(100, "Bad", 50)
    print(bad_car)
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print("Distance_driven (expected 20):", bad_car.drive(20))
    print(bad_car)
Ejemplo n.º 8
0
def main():
    good_car = UnreliableCar("good car", 100, 90)
    bad_car = UnreliableCar("bad car", 100, 9)

    for i in range(1, 20):
        print("Attempting to drive {}km:".format(i))
        print("{:20} drove {}km".format(good_car.name, good_car.drive(i)))
        print("{:20} drove {}km".format(bad_car.name, bad_car.drive(i)))

    print(good_car)
    print(bad_car)
def main():
    good_car = UnreliableCar("Mostly Good", 100, 90)
    bad_car = UnreliableCar("Dodgy", 100, 9)

    for i in range(1, 12):
        print("Attempting to drive {}km:".format(i))
        print("{:12} drove {:2}km".format(good_car.name, good_car.drive(i)))
        print("{:12} drove {:2}km".format(bad_car.name, bad_car.drive(i)))

    print(good_car)
    print(bad_car)
def main():
    """Test unreliable car program"""
    car1 = UnreliableCar("Car1", 100, 99)
    car2 = UnreliableCar("Car2", 100, 40)

    for km in range(1, 20):
        print("Attempting to drive {}km:".format(km))
        print("{:5} drove {:2}km".format(car1.name, car1.drive(km)))
        print("{:5} drove {:2}km".format(car2.name, car2.drive(km)))

    print(car1)
    print(car2)
Ejemplo n.º 11
0
def main():
    nice_car = UnreliableCar("Mostly Good", 100, 80)
    not_nice_car = UnreliableCar("bad", 100, 8)

    for i in range(1, 12):
        print("Attempting to drive {}km:".format(i))
        print("{:12} drove {:2}km".format(nice_car.name, nice_car.drive(i)))
        print("{:12} drove {:2}km".format(not_nice_car.name,
                                          not_nice_car.drive(i)))

    print(nice_car)
    print(not_nice_car)
Ejemplo n.º 12
0
def main():
    """Test unreliable car program"""
    my_unreliable_car = UnreliableCar("Ferrari", 100, 70)
    my_unreliable_car1 = UnreliableCar("Bugatti", 100, 10)

    for km in range(1, 8):
        print("Attempting to drive {}km:".format(km))
        print("{:5} drove {:2}km".format(my_unreliable_car.name, my_unreliable_car.drive(km)))
        print("{:5} drove {:2}km".format(my_unreliable_car1.name, my_unreliable_car1.drive(km)))

    print(my_unreliable_car)
    print(my_unreliable_car1)
Ejemplo n.º 13
0
def main():
    """Test of unreliability of cars"""
    # make cars with different reliability
    dodgy_car = UnreliableCar("Dodgy", 100, 12)
    bulletproof_car = UnreliableCar("Mint", 100, 95)

    for i in range(1, 12):
        print("Trying to drive {}km:".format(i))
        print("{:12} drove {:2}km".format(bulletproof_car.name,
                                          bulletproof_car.drive(i)))
        print("{:12} drove {:2}km".format(dodgy_car.name, dodgy_car.drive(i)))

    print(bulletproof_car)
    print(dodgy_car)
Ejemplo n.º 14
0
def main():
    """Function to test the reliability of a car"""

    # Create cars with diffrent reliabilities
    Reliable_car = UnreliableCar("Mostly Good", 100, 90)
    Unreliable_car = UnreliableCar("Dodgy", 100, 9)

    # Multiple drives of the car attempted to test its reliability
    # output the distance they drove
    for i in range(1, 12):
        print("Attempting to drive {}km:".format(i))
        print("{:12} drove {:2}km".format(Reliable_car.name, Reliable_car.drive(i)))
        print("{:12} drove {:2}km".format(Unreliable_car.name, Unreliable_car.drive(i)))

    # Print Final car state
    print(Reliable_car)
    print(Unreliable_car)
Ejemplo n.º 15
0
from unreliable_car import UnreliableCar

car_1 = UnreliableCar("Name", 100, 50)

car_1.drive(100)

print(car_1)
Ejemplo n.º 16
0
def main():
    """reliability set to 50% and doing 100 1km drives. odometer shows roughly 50km driven"""
    fiesta = UnreliableCar("Ford Fiesta", 100, 50)
    for x in range(0, 100):
        print(fiesta.drive(1))
    print(fiesta)
Ejemplo n.º 17
0
def main():
    my_car = UnreliableCar("Bomb", 120, 60)
    print("My bomb drove ", my_car.drive(random.randint(0, 100)), "km")
Ejemplo n.º 18
0
def main():
    taxi = UnreliableCar("Prius 1", 100, 50)
    taxi.drive(20)
    print(format(taxi) + "\n")
    taxi.drive(20)
    print(format(taxi) + "\n")
    taxi.drive(20)
    print(format(taxi) + "\n")
    taxi.drive(20)
    print(format(taxi) + "\n")
    taxi.drive(20)
    print(format(taxi) + "\n")
def main():
    car = UnreliableCar("Taxi", 100, 70)
    print(car.drive(55))

    print(car)
def main():
    car1 = UnreliableCar("Prius 1", 100, 50)
    car1.drive(40)
    print("{} has {} units of fuel and has driven {}".format(
        car1.name, car1.fuel, car1.odometer))
from unreliable_car import UnreliableCar

car_1 = UnreliableCar("Prius_1", 100, 90)
car_2 = UnreliableCar("Prius_2", 100, 9)

for i in range(1, 10):
    print("Attempt {}".format(i))
    print("{} drove {}km".format(car_1.name, car_1.drive(i)))
    print("{} drove {}km".format(car_2.name, car_2.drive(i)))

print(car_1)
print(car_2)
Ejemplo n.º 22
0
def main():
    """Test cases for UnreliableCar class"""
    prius_taxi = UnreliableCar("Prius 1", 100, 50)
    for line in range(10):
        prius_taxi.drive(20)
        print(prius_taxi.odometer, prius_taxi.fuel)
Ejemplo n.º 23
0
from unreliable_car import UnreliableCar

car1 = UnreliableCar("prius", 100, 1)
car1.drive(40)
print(car1)  # prius fails to drive (almost always)

car2 = UnreliableCar("porsche", 100, 100)
car2.drive(40)
print(car2)  # porsche can drive
Ejemplo n.º 24
0
def main():
    car = UnreliableCar("Prius 1", 100, 50)
    car.drive(40)
    print(car)
"""Test UnreliableCar class methods."""

from unreliable_car import UnreliableCar

car_1 = UnreliableCar('Car 1', 100, 84.3)
print(car_1)
car_1.add_fuel(1500)
print(car_1)
car_1.drive(1243)
print(car_1)
car_1.drive(30)
print(car_1)
car_1.drive(30)
print(car_1)
car_1.drive(30)
print(car_1)
car_1.drive(30)
print(car_1)
Ejemplo n.º 26
0
def main():
    Honda = UnreliableCar("Honda", 100, 30)
    print(Honda.drive())
Ejemplo n.º 27
0
def main():
    """Test the UnreliableCar class."""
    lemon = UnreliableCar('Bessy', 100, 50)
    print(lemon)
    lemon.drive(40)
    print(lemon)
Ejemplo n.º 28
0
from unreliable_car import UnreliableCar

if __name__ == '__main__':

    test_unreliable = UnreliableCar("Test", 100, 50)
    test_unreliable.drive(50)
    print(test_unreliable)
Ejemplo n.º 29
0
def main():
    car = UnreliableCar('Bad Car', 100, 50)
    car.drive(50)
    print(car)