Question: 3 : Create a Rectangle Class C# Write a program that defines a Rectangle class and interacts with it to calculate the area and perimeter.

3: Create a Rectangle Class
C# Write a program that defines a Rectangle class and interacts with it to calculate the area and perimeter.
Instructions:
Define a Rectangle class:
The class should have the following private fields:
double Length
double Width
Create a constructor that takes two parameters (length and width) and initializes the fields.
Add public properties to get and set the values of Length and Width.
Add a method CalculateArea() that returns the area of the rectangle (Length Width).
Add a method CalculatePerimeter() that returns the perimeter of the rectangle (2(Length + Width)).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Programming Questions!