Answered You can hire a professional tutor to get the answer.

QUESTION

C# method that has one parameter (named radius) and a return statement that returns the area of a circle.

C# method that has one parameter (named radius) and a return statement that returns the area of a circle. This method is an instance method (not a static function) and will perform the following operations:

  • Define a local variable named localRadius and a local variable named area;
  • Assign the parameter radius to the local variable localRadius;
  • Calculate the area of the circle, the formula of which is area = pi * radius2;
  • Return the area in its return statement.

Then, in the main method, define two variables (named mradius and marea). The main method creates an instance of the class by calling the default constructor which calls the method above and pass mradius to the method. After the statements in the method are done, the returned value from the method is assigned to marea. The main method prints the value of marea (using Console.WriteLine()).

This is what I have done so far

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApp39

{

   class CircleClass

   {

       public void Instance (double radius)

       {

           double localRadius = 0;

           double area = 0;

           double pi = 3.14;

           localRadius = 2;

               area = pi * radius * radius

               return area;

       }

       static void Main(string[] args);

       double mradius = 0;

       double marea = 0;

       CircleClass circlearea = new CircleClass();

       circlearea.CircleClass(marea);

   }

}

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question