Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Preliminaries For this lab you will be working with the following classes that represent cars class Car: for sale at various car dealership def _init_(self,
Preliminaries For this lab you will be working with the following classes that represent cars class Car: for sale at various car dealership def _init_(self, id, brand, price, attributes) self. id id self-brand brand self.price - price self.attributes = attributes class CarAttributes: def init_(self, paint, tires, trim): CSE 101 -Fall 2017 Lab #8 self.paint - paint self.tires tires self.trim = trim class Dealership: def name): _-init-(self, self.carlist car self. name = name car-list, list - - def add_cars (self, cars): return None # you will write this method in Part 1 def update_car (self, id, new value) return None # you will write this method in Part II You will be asked to write two methods inside the Dealership class and one function. For the examples below we will be using the following objects, but CodeLoad will contain more cars. carl Car (1, , Ford, , 2 3000, CarAt tributes ("Red, , , Rain, , , Level-1' ) ) car2 Car(2, 'BMW', 46000, CarAt tributes ("Blue ,, ,Regular, , ,Regular, )) car3= Car (3, 'Ferrari', 150000, CarAttributes ("Violet,, ,Regular,, ,Level-2,)) car4 Car (4, 'Toyota', 26000, CarAt tributes ("Black', ,Snow,, ,Regular, )) car5-Car (5, BM 50000, CarAttributes 'Red, Sport', 'Level-3')) car6= Car (6, 'Lotus', 50000, CarAttributes ("Grey', 'Sport', 'Regular')) car7 = Car (7, 'Audi', 40000, CarAt tributes ('Blue', 'Regular', 'Level-2,)) car8- Car (8, Audi',45000, CarAttributes ('BlueRain', 'Regular) car9= Car (9, 'Ford', 30000, CarAt tributes ("Violet, , ,Sport ,, ,Level-1')) dealership! = Dealership ([carl, car2, car3], ,KMac,) dealership2 = Dealership( [car4, car5, car6, car7], ,JRM') dealership3 = Dealership ( [car8, car9] , , YPeng, ) Note: A special method called reset.cars ) is given to reset the updated values to original values of the object after certain operations have been performed. Do not call this function from inside your own methods or
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started