Question: C# Shape Hierarchy EmptyTextShape +Width: int read-onlys +Height: int read-onlys +Name : string eread-onlys +FillCharacter: char +Draw: void +Area : decimal +Perimeter : decimal +ToString)
Shape Hierarchy EmptyTextShape +Width: int read-onlys +Height: int read-onlys +Name : string eread-onlys +FillCharacter: char +Draw: void +Area : decimal +Perimeter : decimal +ToString) :string Rectangle +Name: string +Area : decimal +Perimeter: decimal +ToString(): string Draw simply prints out the contents in the ToStringl) to the Console. Empty string because it Square has no shape. -Name : string UpleftTriangle 5-45-90 triangle +Name:string +Area: decimal +Perimeter : decimal ToString): string The value of Height in Triangles and Squares will be the same as the Width. UpRightTriangle +Name : string ToString): string BottomLeftTriangle Name : string ToString) string BottomRightTriangle +Name : string ToString(): string The class diagram is given in the figure. The ones specified by read-only cannot be changed from outside. However, they are all public members. The shapes are shown next to each class. The Area and the Perimeter will calculate the area and the perimeter of the shape. EmptyTextShape has both of these values to be 8 in addition to an empty string in the ToString() method. The ToString() method overrides will return the actual string of the shape, starting from the beginning and using the character in the Fi11Character, which can be changed anytime and has a default value of asterisk *, The Draw method will simply print them to Console app. The area and the perimeter will calculate the area. The Name will simply return the class name with spaces instead of camel case in all lower cases (eg "bottom right triangle", or "empty shape" for the base class). With 00P, make sure you've learned how to reuse your codes (logic in constructors, methods, and properties), but I'm not going to enforce it. Learn how to perform commonality analysis For the triangles, we will use the same width and the same for the height so that they will be 45-45-90 right triangles. Shape Hierarchy EmptyTextShape +Width: int read-onlys +Height: int read-onlys +Name : string eread-onlys +FillCharacter: char +Draw: void +Area : decimal +Perimeter : decimal +ToString) :string Rectangle +Name: string +Area : decimal +Perimeter: decimal +ToString(): string Draw simply prints out the contents in the ToStringl) to the Console. Empty string because it Square has no shape. -Name : string UpleftTriangle 5-45-90 triangle +Name:string +Area: decimal +Perimeter : decimal ToString): string The value of Height in Triangles and Squares will be the same as the Width. UpRightTriangle +Name : string ToString): string BottomLeftTriangle Name : string ToString) string BottomRightTriangle +Name : string ToString(): string The class diagram is given in the figure. The ones specified by read-only cannot be changed from outside. However, they are all public members. The shapes are shown next to each class. The Area and the Perimeter will calculate the area and the perimeter of the shape. EmptyTextShape has both of these values to be 8 in addition to an empty string in the ToString() method. The ToString() method overrides will return the actual string of the shape, starting from the beginning and using the character in the Fi11Character, which can be changed anytime and has a default value of asterisk *, The Draw method will simply print them to Console app. The area and the perimeter will calculate the area. The Name will simply return the class name with spaces instead of camel case in all lower cases (eg "bottom right triangle", or "empty shape" for the base class). With 00P, make sure you've learned how to reuse your codes (logic in constructors, methods, and properties), but I'm not going to enforce it. Learn how to perform commonality analysis For the triangles, we will use the same width and the same for the height so that they will be 45-45-90 right triangles
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
