Ejemplo n.º 1
0
 def __init__(self,make,model,mileage,price,door):
     Automobile.__init__(self,make,model,mileage,price)
     self.make=make
     self.model=model
     self.mileage=mileage
     self.price=price
     self.door=door
Ejemplo n.º 2
0
    def test_engine_trans_frame_serial_build_in_any_order(self):
        auto = Automobile('serialparallel', BuildAutoTest.rate)
        auto.build_frame()
        self.assertEqual("frame built", auto.build_state())

        auto.build_transmission()
        self.assertEqual("transmission built", auto.build_state())

        auto.build_engine()
        self.assertEqual("engine built", auto.build_state())
Ejemplo n.º 3
0
def add_vehicle(all_vehicles):
    make = input('Enter make : ')
    model = input('Enter model : ')
    color = input('Enter color : ')
    year = int(input('Enter year : '))
    mileage = int(input('Enter mileage : '))
    vehicle_id = len(all_vehicles)
    automobile = Automobile(vehicle_id, make, model, color, year, mileage)
    print('Vehice added with id : ' + str(vehicle_id))
    all_vehicles.append(automobile)
x_change = 0

barrierList = []

joysticks = []

pygame.joystick.init()

c = Controller()

fl = Motor(4)
fr = Motor(17)
br = Motor(22)
bl = Motor(27)

auto = Automobile(fr, br, fl, bl)

angle = 0
rotation = ''

running = True
while running:

    screen.fill((0,0,0))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running = False

        if event.type == pygame.JOYBUTTONDOWN:
            #This will include all button actions
            # 0 = A
Ejemplo n.º 5
0
# Automobile Example
# test2.py file

from automobile import Automobile

herbie = Automobile("VW Bug", "yellow")
christine = Automobile("Plymouth Fury", "red")

print(christine.color)
herbie.color = "white"

for i in range(0, 5):
    herbie.accelerate()
    christine.accelerate()
    print("herbie", herbie.velocity)
print("christine", christine.velocity)

for i in range(0, 3):
    herbie.brake()

print(christine.velocity, herbie.velocity)
print(herbie)
print(christine)
Ejemplo n.º 6
0
 def test_Model(self):
     model = Automobile(123, 'sedan', 'merceedes', 'red', 1994, 2000)
     self.assertEqual(self.auto.get_model(), 'sedan')
Ejemplo n.º 7
0
from motor import Motor
from automobile import Automobile

fl = Motor(4)
fr = Motor(17)
br = Motor(22)
bl = Motor(27)

robot = Automobile(fr, br, fl, bl)

while True:
    fl.forward()
    #robot.drive()
Ejemplo n.º 8
0
    def __init__(self, make_in, model_in, year_in, doors_in):
        #Initializes the superclass
        Automobile.__init__(self, make_in, model_in, year_in)

        #Initializes its own field
        self.doors = doors_in
Ejemplo n.º 9
0
 def __init__(self, make, model, mileage, price, drive_type):
     Automobile.__init__(self, make, model, mileage, price)
     self.__drive_type = drive_type
Ejemplo n.º 10
0
        self.velocity += 15
        if self.velocity > 120.0:
            self.velocity = 120.0

    def brake(self):
        self.velocity -= 20
        if self.velocity < 0.0:
            self.velocity = 0.0


# Automobile Example
# test1.py file

from automobile import Automobile

auto = Automobile("Ford Taurus", "red")
print(str(auto))
# Next line has same effect as preceding line.
# str method is automatically called when
# an object printed.
print(auto)
print(auto.model, auto.color)

auto.accelerate()
auto.accelerate()
auto.accelerate()
print(auto.velocity)

auto.brake()
auto.brake()
print(auto.velocity)
Ejemplo n.º 11
0
 def __init__(self,make,model,mileage,price,drive_type):
      auto.__init__(self,make,model,mileage,price)
Ejemplo n.º 12
0
 def __init__(self,make,model,mileage,price,doors):
      auto.__init__(self,make,model,mileage,price)
Ejemplo n.º 13
0
 def __init__(self,make,model,mileage,price,pass_capacity):
      auto.__init__(self,make,model,mileage,price)
Ejemplo n.º 14
0
 def test_ID(self):
     autoId = Automobile(123, 'sedan', 'merceedes', 'red', 1994, 2000)
     self.assertEqual(self.auto.vehicle_id, autoId)
Ejemplo n.º 15
0
 def __init__(self, __make, __model, __mileage, __price, __drive):
     Automobile.__init__(self, __make, __model, __mileage, __price)
     self.__drive = __drive
Ejemplo n.º 16
0
 def __init__(self,make,model,mileage,price,doors):
     Automobile.__init__(self,make,model,mileage,price)
     self.__doors=doors
Ejemplo n.º 17
0
 def __init__(self, make, model, mileage, price, pass_cap):
     Automobile.__init__(self, make, model, mileage, price)
     self.__pass_cap = pass_cap
Ejemplo n.º 18
0
 def test_auto_factory(self):
     auto = Automobile('serial', BuildAutoTest.rate)
     self.assertEqual("not started", auto.build_state())
Ejemplo n.º 19
0
    def test_build_auto(self):
        auto = Automobile('serial', BuildAutoTest.rate)

        auto.build_engine()
        self.assertEqual("engine built", auto.build_state())

        auto.build_transmission()
        self.assertEqual("transmission built", auto.build_state())

        auto.build_frame()
        self.assertEqual("frame built", auto.build_state())

        auto.build_chassis_part1()
        self.assertEqual("chassis part 1 built", auto.build_state())
        auto.build_chassis_part2()
        self.assertEqual("chassis part 2 built", auto.build_state())
        auto.build_chassis_part3()
        self.assertEqual("chassis part 3 built", auto.build_state())

        auto.post_chassis_assembly()
        self.assertEqual("post chassis assembly complete", auto.build_state())

        auto.add_fluids()
        self.assertEqual("fluids added", auto.build_state())

        auto.test_drive()
        self.assertEqual("Beep Beep", auto.build_state())
Ejemplo n.º 20
0
 def __init__(self, __make, __model, __mileage, __price, __doors):
     Automobile.__init__(self, __make, __model, __mileage, __price)
     self.__doors = __doors
Ejemplo n.º 21
0
 def test_build_parallel(self):
     auto = Automobile('parallel', BuildAutoTest.rate)
     auto.build()
     self.assertEqual("Beep Beep", auto.build_state())
Ejemplo n.º 22
0
 def __init__(self, mode, rate):
     Automobile.__init__(self, mode, rate)
     self.type = "sports car"
Ejemplo n.º 23
0
 def __init__(self, make_in, model_in, year_in, riders_in):
     Automobile.__init__(self, make_in, model_in, year_in)
     self.riders = riders_in