Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Concepts

Authors: David Kroenke

4th Edition

0136086535, 9780136086536

More Books

Students also viewed these Databases questions

Question

Write short notes on departmentation.

Answered: 1 week ago

Question

What are the factors affecting organisation structure?

Answered: 1 week ago

Question

What are the features of Management?

Answered: 1 week ago

Question

Briefly explain the advantages of 'Management by Objectives'

Answered: 1 week ago