Sunday, 5 May 2013

john is a software developer, who works for Maga Technologies. He is currently under the project of geometric calculations.the program that john to develop should: 1.Calculate the area of circle. 2.Calculate the volume of the cube.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication8
{
    interface Area
    {
        void calcArea(double Radius);
    }
    interface Volume
    {
        void calc1(int Side);
    }
    public class CircleCube:Area
    {
        public void calcArea(double Radius)
        {
            double Pie=3.14;
            double Result;
            Result=Pie*Radius;
            Console.WriteLine("the Area of the circle is:{0}",Radius);
        }
        public void calcVolume(int Side)
        {
            int Result;
            Result=Side*Side*Side;
            Console.WriteLine("the Volume of the cube is:{0}",Result);
        }
    }
    class class1
    {
     public   static void Main(string[] args)
        {
            CircleCube obj = new CircleCube();
            double Radius;
            int Side;
            Console.WriteLine("enter the side of a cube");
            Radius = Convert.ToDouble(Console.ReadLine());
            obj.calcArea(Radius);
            Console.WriteLine("enter the Side of a cude");
            Side = Convert.ToInt32(Console.ReadLine());
            obj.calcArea(Side);
            Console.ReadLine();

        }
    }
}

1 comment: