Question: In Python Part 1. Create a class Rectangle with simple construction of objects, accessing of rectangle, and possibility of setting the parameters of a rectangle

In Python

Part 1. Create a class Rectangle with simple construction of objects, accessing of rectangle, and possibility of setting the parameters of a rectangle based on the Point Example. Test your code:

a. Create rectangle rectangle1

b. Set parameters of the rectangle so that its down-left corner is in the origin and the up-right corner has position <2,2>

c. Print the values of position of down-left corner and the up-right corner

Part 2. Modify the class Rectangle i.e. include construction of an object with arguments, modify creating string description of the rectangle, computing diagonal of the rectangle, scaling rectangle, shifting rectangle, normalizing rectangle ( setting its down-left corner is in the origin and making diagonal equal to 1) based on the Point example. Test your code:

d. Create rectangle rectangle2 with its down-left corner is in the origin and with the up-right corner in position <2,2>

e. Print the values of position of down-left corner and the up-right corner

f. Print the value of the string describing rectangle2

g. Compute and print diagonal of rectangle2

h. Normalize rectangle2 and print the value of the string describing new rectangle2

i. Create rectangle rectangle3 with its down-left corner in position <1,1> and with the up-right corner in position <3,2>

j. Print the value of the string describing rectangle3

k. Compute and print diagonal of rectangle3

l. Normalize rectangle2 and print the value of the string describing new rectangle3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!