Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement the method add cars() for the Dealership class.Plase use python to solve the problem. For this lab you will be working with the folkowing

image text in transcribedImplement the method add cars() for the Dealership class.Plase use python to solve the problem.

For this lab you will be working with the folkowing classes that represent cars for sale at various car dealerships: class Car: detinit(salt. id, brand, prica,ateributea) sct.id id self.brand-brand alE price-prico clas carAt tributes : CSE 101-Fall 2017 Lab 48 Page I sel.paint- paint selt.trimtrin class Daalership: a. I f.ea r 1iat 11st _ er dcf addcars (sclf, cars): retirn None # you will write thia method in Part 1 ct new-value); update-car(sc-t, eturn None id, you will write this nethod in Part II You will be asked to write two methods inside the Dealcrship class and one function. For the examples below we will be using the following objects, but CodeLoad will contain more cars. car2 Car (2, ' H ", 46000, Carnttributes BLue, , , Regular, , Regular, } } car3 Car(3, Ecrrri',150000, CarAttributes l'violetcqularLevel-2) car4 -Car (4 rToyota', 26000, CarAttributea['Black', ,Snow. ,Regular, } } car6 car ( 6, carT. Car(7 car8-Car (Hr Lotus, 50000, carnttributes [ , Grey, , , Sport, , Requar, } } 'Audi', 40000, CarAt t ributes 'Blue, , ,Regular. r1ave 1-2, }} r Audi' , 45000, CarAttributes ' Blue' , , Rain' , Regular" } } dealerahipl Dealerahiplicarl, carz, car3 Mac dealorahipzDaalerahipar4, ca, car, car dealerzhipDcalershipcar8, car9 Yenq) Nute: A special method called raset.cars) is given to reset the updated values to original values of the object after certain operations have been performed. Do not call this fiuncrion frow inside your ownmethods or Part I: Add a Car to a Dealership (20 points) Implement the method add-cars () for the Dealership class. The method takes one argument. cars, which is a list of ists of car details. Each list within the cars list represents the details (properties) for a single car. You my assume the entire list is always valid. A dktails list or aparticular car will always be presented in this order: lia, rand, price, coor, tires, trim-Leve-1. Theia, brana and price will be stored inside a Car object and the other three properties will be stored inside a Carattributes object inside the Car object. Your method should create new Car objects and add them to the car.list given to you in the Dealership SE 101 -Fall 2017 Lab #8 Page 2 Examples: Consider the folloaing lists of lists of car details piiist- [12, Ford, 20 eaRain'Level-1'1 p2List ! p3ist [13, 'Nercedes, 10000, Gey'Snow 'Regular 1, [14, Nercedes, 40000, 'lueSnow Regular Function Call: dealership. add_cars pi List ) Updated dealership!ear-list: car: [ Ford _ 23000-Attributes: Red-Rain-Level-11 1 Car: rd _ 20000 -Attributes: Red _ Rain _ Level-1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

Explain the various collection policies in receivables management.

Answered: 1 week ago

Question

What are the main objectives of Inventory ?

Answered: 1 week ago

Question

Explain the various inventory management techniques in detail.

Answered: 1 week ago