Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN PYTHON PLEASE Exercise Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods Two Class

IN PYTHON PLEASE

image text in transcribed

Exercise Design and implement class Rectangle to represent a rectangle object. The class defines the following attributes (variables) and methods Two Class variables of type double named height and width to represent the height and width of the rectangle. Set their default values to 1.0 in the default constructor. 2. A non-argument constructor method to create a default rectangle 3. Another constructor method to create a rectangle with user-specified height and width Python only: use the classmethod decorator . 4. Method getArea () that returns the area 5. Method getPerimeter() that returns the perimeter 6. Method getHeight ) that returns the height. 7. Method getWidth() that returns the width Now design and implement a test program to create two rectangle objects: one with default height and width, and the second is 5 units high and 6 units wide. Next, test the class methods on each object to print the information as shown below Sample run First object: Height: Width: Area: Perimeter 4 units 1 unit 1 unit 1 unit Second object: Height: 5 unit Width Area: Perimeter 22 units 6 unit 30 units

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

Databases Theory And Applications 27th Australasian Database Conference Adc 20 Sydney Nsw September 28 29 20 Proceedings Lncs 9877

Authors: Muhammad Aamir Cheema ,Wenjie Zhang ,Lijun Chang

1st Edition

3319469215, 978-3319469218

More Books

Students also viewed these Databases questions

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

What magazine and ads did you choose to examine?

Answered: 1 week ago