Hello I Need To Develop An Automobile Class That Will Be Used By A Dealership As


I need to develop an automobile class that will be used by a dealership as a vehicle inventory program. The following attributes should be present: Private string make, model, color, int year, and int mileage. The program needs a constructor, add new vehicle, remove vehicle, update vehicle attributes

Below is the code that I have had help on but when ran it is stating I need to define vehicle.Please help. Thank you

class Automobile:

  def __init__(self, make, model, color, year, mileage):

    self._make = make

    self._model = model

    self._color = color

    self._year = year

    self._mileage = mileage

def set_make(self, m):

  self._make= m

def set_model(self, m):

  self._model = m

def set_color(self, m):

  self._color = m

def set_year(self, m):

  self._year = m

def set_mileage(self, m):

  self._mileage = m

def get_make(self):

  return self._make

def get_model(self):

  return self._model

def get_color(self):

  return self._color

def get_year(self):

  return self._year

def get_mileage(self):

  return self._mileage

vehicles = [ ]

def add_vehicle(vehicle):

    global vehicles


def remove_vehicle(make):

    for i in range(len(vehciles)):

      if vehicles[i].get_make( ) == make:

        del vehciles[i]

def update_vehicle(index, make, model, color, year, mileage):

    global vehicles

    v = vehicles[index]





def write_file( ):

    file = open (‘vehicles.txt’, ‘k’)

    for a in vehicles:



    file.close( )

def main( ):

  menu = { }

  menu [‘1’] = ‘Add vehicle’

  menu [‘2’]= ‘Remove vehicle’

  menu [‘3’] = ‘Find Vehicle’

  menu [‘4’] = ‘Quit/Exit’

user = True

while user:


  1. Add vehicle

  2. Remove vehicle

  3. Find vehicle

  4. Quit/Exit


  ans= input(‘Choose options, 1. to add a vehicle, 2. to remove a vehicle, 3. to find a vehicle, or 4. to quit/exit. ‘)

  if ans == ‘1’:


  elif ans == ‘2’:


  elif ans == ‘3’:


  elif ans == ‘4’:

    print (‘Goodbye’)

  elif ans != ”:

    print(‘Invalid entry’)

if __name__ == ‘__main__’:

  main ( )

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply