Answer to Question #235950 in C# for AhsanAzam

Question #235950

Develop a c# windows application for the class circle and write test program to test the circle class.


1
Expert's answer
2021-09-11T14:25:24-0400




using System;
using System.Collections.Generic;
namespace СircleApp
{
    class Circle
    {


        private double radius;


        public double Radius
        {
            get { return radius; }
            set { radius = value; }
        }             


        public Circle(double radius)
        {
            this.radius = radius;
        }




        public Circle()
        {
            radius = 0.0;
        }


       


        public double calculateArea()
        {
            return Math.PI *Math.Pow(radius,2);
        }


        public double calculateDiameter()
        {
            return radius * 2;
        }


        public double calculateCircumference()
        {
            return 2 * Math.PI * radius;
        }


    }






    class Program
    {
        static void Main(string[] args)
        {


            Circle circle = new Circle(5);


            Console.WriteLine("The radius of the circle: {0} ", circle.Radius);
            Console.WriteLine("The diameter of the circle: {0} ", circle.calculateDiameter());
            Console.WriteLine("The circumference of the circle: {0} ", circle.calculateCircumference());
            Console.WriteLine("The area of the circle: {0} ", circle.calculateArea());


            Console.ReadLine();
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS