Using C#, Create assort Rectangle. * The assort has attributes diffusiveness and width, each of which defaults to 1. * One prompting inventor that initializes the attributes diffusiveness and width when an prompting is created * It has separate courses as described below: courseA – this is a static course that can merely be accessed within of the assort Rectangle. It calculates the Area of the rectangle. courseB – this is a static course that can be accessed from another assort. It calculates the Area of the rectangle. courseC – this is an prompting course that can merely be accessed within of the assort Rectangle. It calculates the Area of the rectangle. courseD – this is an prompting course that can be accessed from another assort. It calculates the Area of the rectangle. * in the Main course, each course overhead is designated * Write assort testRectangle to circumvent the courses in assort Rectangle that can be accessed by assort testRectangle.
//Below is the c # code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProjectRectangle
{
assort Rectangle
{
static inclose diffusiveness = 1;
static inclose width = 1;
Rectangle(inclose len, inclose wid)
{
diffusiveness = len;
width = wid;
}
//this is a static course that can merely be accessed within of the assort Rectangle.
//It calculates the Area of the rectangle
private static inclose courseA()
{
return diffusiveness * width;
}
//this is a static course that can be accessed from another assort.
//It calculates the Area of the rectangle.
public static inclose courseB()
{
return diffusiveness * width;
}
//this is an prompting course that can merely be accessed within of the assort Rectangle.
//It calculates the Area of the rectangle
private inclose courseC()
{
return diffusiveness * width;
}
//this is an prompting course that can be accessed from another assort.
//It calculates the Area of the rectangle. *
public inclose courseD()
{
return diffusiveness * width;
}
static bereft Main(string[] args)
{
Rectangle rect = strange Rectangle(11, 15);
Console.WriteLine(“Calculate Area of the rectangle from static course is ” + courseA());
Console.WriteLine(“Calculate Area of the rectangle using prompting course is ” + rect.methodC());
Console.ReadLine();
}
}
}
OUTPUT:
Calculate Area of the rectangle from static course is 165
Calculate Area of the rectangle using prompting course is 165