Use a new cell in your notebook 2. Create the following classes in your notebook (paste code into a cell, using proper indentation): class Car(object): def init(self, color='red'): self.color=color class Tire(object): def init(self, miles=0): self.miles = miles def add_miles(self, miles): self.miles += miles 1. Create a class named CustomCar() that is itself, a child-class of car.car 2. Create a class named CustomTire() that is, itself, a child-class of car. Tire 3. Override the class constructor Customcar() has inherited from Car() and, in it, call the car() constructor. To do this, you must call the car.Car() constructor as a class method and not as an instance method. A snippet containing this construction is as below: below: car.car._init__(self, color) This calls the constructor to do its work but instead of creating a new instance of car.car() we pass it the current instance of CustonCar() as self 4. Add an additional argument named tires to the Customcar() constructor 4. Add an additional argument named, tires to the Customcar() constructor. 1. Generally, this should be a list of CustomTire() objects ii. The default of this argument should be None 5. Add a new instance attribute to CustomCar() called tires to store a list of tires 1. Assign the new instance attribute the value of the tires argument ii. If the value of the tires argument is None : a. Create a list b. Create four new instances of the CustomTire() class and append each into the list 6. Add a pseudo-private class attribute to the customTires() class called maximum_miles and assign it a value of 580. 7. Test that your customcar() class works with both a tires argument and without. Expected Output >>> mycar = CustomCar() >>> len(mycar. tires) >>> isinstance(mycar.tires[0], CustomTire) True Code should be submitted via Blackboard.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Use a new cell in your notebook 2. Create the following classes in your notebook (paste code into a cell, using proper indentation): class Car(object): def init(self, color='red'): self.color=color class Tire(object): def init(self, miles=0): self.miles = miles def add_miles(self, miles): self.miles += miles 1. Create a class named CustomCar() that is itself, a child-class of car.car 2. Create a class named CustomTire() that is, itself, a child-class of car. Tire 3. Override the class constructor Customcar() has inherited from Car() and, in it, call the car() constructor. To do this, you must call the car.Car() constructor as a class method and not as an instance method. A snippet containing this construction is as below: below: car.car._init__(self, color) This calls the constructor to do its work but instead of creating a new instance of car.car() we pass it the current instance of CustonCar() as self 4. Add an additional argument named tires to the Customcar() constructor
4. Add an additional argument named, tires to the Customcar() constructor. 1. Generally, this should be a list of CustomTire() objects ii. The default of this argument should be None 5. Add a new instance attribute to CustomCar() called tires to store a list of tires 1. Assign the new instance attribute the value of the tires argument ii. If the value of the tires argument is None : a. Create a list b. Create four new instances of the CustomTire() class and append each into the list 6. Add a pseudo-private class attribute to the customTires() class called maximum_miles and assign it a value of 580. 7. Test that your customcar() class works with both a tires argument and without. Expected Output >>> mycar = CustomCar() >>> len(mycar. tires) >>> isinstance(mycar.tires[0], CustomTire) True Code should be submitted via Blackboard.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY