using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DashainBhandari_AreaofRectangle_1010
{
class Shape
{
protected double width;
protected double height;
// Setter methods
public void SetWidth(double w)
{
width = w;
}
public void SetHeight(double h)
{
height = h;
}
}
// Derived class inheriting from base class
class Rectangle : Shape
{
// Method to calculate area of rectangle
public double GetArea()
{
return width * height;
}
}
class Program
{
static void Main(string[] args)
{
Rectangle rect = new Rectangle();
// Input width of rectangle
Console.Write("Dashain Bhandari: ");
Console.Write("Enter the width of the rectangle: ");
double width = Convert.ToDouble(Console.ReadLine());
rect.SetWidth(width);
// Input height of rectangle
Console.Write("Enter the height of the rectangle: ");
double height = Convert.ToDouble(Console.ReadLine());
rect.SetHeight(height);
// Calculate and display area of rectangle
Console.WriteLine("Area of Rectangle: " + rect.GetArea());
}
}
}