subject

Implement a class named Rectangle. The class should contain: 1. Two data attributes of type float named width and height that specify the width and the height of the rectangle.
2. A constructor that creates a rectangle with the specified width and height. If no argument is provided, it should use 1.0 for both values. If any input value is negative, the function should raise an exception.
3. Functions get_width and get_height that return the corresponding value
4. The set_width and set_height function that update the values if and only if the input is positive; otherwise do nothing
5. Functions get_area and get_perimeter that return the area and the perimeter of this rectangle respectively.
6. A function rotate that swaps the height and width of a rectangle object.
7. A class variable count that keeps track of the number of rectangles created so far.
8. A class method get_count that returns the above value.
9. An equality operator that returns True if and only if the two rectangles are of the same shape.
10. A __str__ function that returns the information of this rectangle in some readable format.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:20
Print "usernum1 is negative." if usernum1 is less than 0. end with newline. convert usernum2 to 0 if usernum2 is greater than 10. otherwise, print "usernum2 is less than or equal to 10.". end with newline
Answers: 3
question
Computers and Technology, 22.06.2019 11:30
Andrina writes letters that are regularly sent to hundreds of her company’s customers. because of this, she would like for the mail merge command to be in her quick access toolbar, and she wants it to be the first button on the left. what should andrina do to place the mail merge button there?
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Determine whether the following careers would require training or college.
Answers: 1
question
Computers and Technology, 22.06.2019 23:30
What does 21 pilots middle aged name as a band 15 years prior to them naming their band 21 pilots?
Answers: 1
You know the right answer?
Implement a class named Rectangle. The class should contain: 1. Two data attributes of type float n...
Questions
question
Mathematics, 29.07.2019 16:50
Questions on the website: 13722363