Question
PYTHON Task 01 (8 points) Create a vehicle class that makes use of encapsulation with the correct naming conventions. It should contain the following: -
PYTHON
Task 01 (8 points)
Create a vehicle class that makes use of encapsulation with the correct naming conventions. It should contain the following:
- Accessors: wheels, doors, fuel, temperature
- Mutators: fuel
Class usage | Example output of script |
car.get_wheels() car.set_fuel(100) | 4 |
Task 02 (10 points)
Create a dog breed class with a constructor that takes the following:
- Name
- Life expectancy
- Size
- Coat type (limit to long, short, curly, etc.)
- Coat color/pattern
Class usage | Example output of script |
gr = Dog("Golden Retriever, 12, "large", "medium", "gold") pg = Dog("Pug", 15, "small", "short","silver fawn") cg = Dog("Corgi", 13, "smol", "fluffy", "tricolor") |
Task 03 (10 points)
Create a rectangle class with the following methods:
- A constructor that takes a length and width as parameters
- A get_rect method that will return the length and width of the rectangle
- A get_area method that will return the area of the rectangle
- A is_square method that will return true if the rectangle is square
- Overload equivalence to compare the length and width of two rectangles and return true if they are equal
Class usage | Example output of script |
abrect = Rectangle(10,10) cdrect = Rectangle(10,10) shrect = Rectangle(10,15) shrect.getrect() abrect.get_area() cdrect.is_square() shrect == abrect abrect == cdrect | 10, 15 100 True False True |
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