(I need help & will give Brainliest)In C#/ Write an application that computes the area of a circle, rectangle, and cylinder. Display a menu showing the three options. Allow users to input which figure they want to see calculated. Based on the value inputted, prompt for appropriate dimensions and perform the calculations using the following formulas: Area of a circle = pi * radius^2 Area of a rectangle = length * width Surface area of a cylinder = 2 * pi * radius * height + 2 * pi * radius^2 Write a modularized solution that includes class methods for inputting data and performing calculations.​

Respuesta :

Answer:using System;

namespace Question

{

   abstract class Figure

   {

       public abstract double Area();

   }

   class Circle : Figure

   {

       public double Radius { get; set; }

       public override double Area()

       {

           return Math.PI * Radius * Radius;

       }

   }

   class Rectangle : Figure

   {

       public double Length { get; set; }

       public double Width { get; set; }

       public override double Area()

       {

           return Length * Width;

       }

   }

   class Cylinder : Figure

   {

       public double Radius { get; set; }

       public double Height { get; set; }

       public override double Area()

       {

           return Math.PI * Radius * Radius * Height;

       }

   }

   class Program

   {

       static void DisplayMenu()

       {

           Console.WriteLine("Please select a figure");

           Console.WriteLine("1 - Circle");

           Console.WriteLine("2 - Rectangle");

           Console.WriteLine("3 - Cylinder");

           Console.WriteLine();

       }

       static int SelectFigure()

       {

           return int.Parse(Console.ReadLine());

       }

       static Figure GetFigure(int selectedFigure)

       {

           if (selectedFigure == 1)

               return new Circle();

           if (selectedFigure == 2)

               return new Rectangle();

           return new Cylinder();

       }

       static void InputCircleData(Circle circle)

       {

           Console.Write("radius = ");

           circle.Radius = double.Parse(Console.ReadLine());

       }

       static void InputRectangleData(Rectangle rectangle)

       {

           Console.Write("length = ");

           rectangle.Length = double.Parse(Console.ReadLine());

           Console.Write("width = ");

           rectangle.Width = double.Parse(Console.ReadLine());

       }

       static void InputCylinderData(Cylinder cylinder)

       {

           Console.Write("radius = ");

           cylinder.Radius = double.Parse(Console.ReadLine());

           Console.Write("height = ");

           cylinder.Height = double.Parse(Console.ReadLine());

       }

       static void InputFigureData(Figure figure)

       {

           if (figure is Circle)

               InputCircleData((Circle)figure);

           else if (figure is Rectangle)

               InputRectangleData((Rectangle)figure);

           else

               InputCylinderData((Cylinder)figure);

       }

       static void Main(string[] args)

       {

           DisplayMenu();

           Console.Write("Your choice: ");

           int selectedFigure = SelectFigure();

           if (selectedFigure >= 1 && selectedFigure <= 3)

           {

               Figure figure = GetFigure(selectedFigure);

               InputFigureData(figure);

               Console.WriteLine();

               Console.WriteLine(string.Format("Area = {0}", figure.Area()));

           }

           else

               Console.WriteLine("Invalid choice");

           Console.WriteLine();

           

           Console.WriteLine();

           Console.ReadKey();

Explanation:I hope this is right and i hope you understand :)and this is so difficult lol :)