Question: Write a class that implements a Square shape. Class Square should contain a Side property for accessing. Private data Provide a constructor that takes a

Write a class that implements a Square shape. Class Square should contain a Side property for accessing. Private data Provide a constructor that takes a side length as a value.

Also Provide the following properties: a) Perimeter returns 4 x Side. b) 

Also Provide the following properties: a) Perimeter returns 4 x Side. b) Area returns Side x Side. c) Diagonal returns the square root of the expression (2 x Side). The perimeter, Area and Diagonal properties should not have corresponding instance variables; rather their Get accessors should use the Side property s value in calculations that return the desired values. Write an app to test your new Square class. C:\Users\frans.rampai\sourceepos\SquareApp\SquareApp\bin\Debug\SquareApp.exe Enter the length of your sqaure: 4 Perimeter of Your Square- 16 CMI Area of your square-16 CM Diagonal of your square-5,65685424949238 CM

Step by Step Solution

3.42 Rating (158 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Code using System class Square private int side public Sq... View full answer

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 Algorithms Questions!