Create an object-oriented program that uses inheritance to perform calculations on a rectangle or a square. Console Rectangle Calculator Rectangle or square? (r/s): r Height: Width: 5 10 Perimeter: 30...


Create an object-oriented program that uses inheritance to perform calculations on a<br>rectangle or a square.<br>Console<br>Rectangle Calculator<br>Rectangle or square? (r/s): r<br>Height:<br>Width:<br>5<br>10<br>Perimeter: 30<br>Area:<br>50<br>* **<br>Continue? (y/n) : y<br>Rectangle or square? (r/s): s<br>Length:<br>Perimeter: 20<br>Area:<br>25<br>* * * * *<br>Continue? (y/n) : n<br>Bye!<br>Specifications<br>• Use a Rectangle class that provides attributes to store the height and width of a<br>rectangle. This class should also provide methods that calculate the perimeter and<br>area of the rectangle. In addition, it should provide a_str_<br>string representation of the rectangle.<br>method that returns a<br>• Use a Square class that inherits the Rectangle class. This class should set the height<br>and the width of the Rectangle superclass to the length that's set in the Square<br>subclass.<br>• The program should detemine whether the user wants to enter a rectangle or a<br>square.<br>• For a rectangle, the program should get the height and width from the user.<br>For a square, the program should get the length of the square from the user.<br>

Extracted text: Create an object-oriented program that uses inheritance to perform calculations on a rectangle or a square. Console Rectangle Calculator Rectangle or square? (r/s): r Height: Width: 5 10 Perimeter: 30 Area: 50 * ** Continue? (y/n) : y Rectangle or square? (r/s): s Length: Perimeter: 20 Area: 25 * * * * * Continue? (y/n) : n Bye! Specifications • Use a Rectangle class that provides attributes to store the height and width of a rectangle. This class should also provide methods that calculate the perimeter and area of the rectangle. In addition, it should provide a_str_ string representation of the rectangle. method that returns a • Use a Square class that inherits the Rectangle class. This class should set the height and the width of the Rectangle superclass to the length that's set in the Square subclass. • The program should detemine whether the user wants to enter a rectangle or a square. • For a rectangle, the program should get the height and width from the user. For a square, the program should get the length of the square from the user.

Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here