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
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