Showing posts with label NIIT PMR 6 SEM1. Show all posts
Showing posts with label NIIT PMR 6 SEM1. Show all posts

Tuesday, 30 April 2013

pmr 6


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("I am a line");
            Console.WriteLine("I am a circle");
            Console.WriteLine("I am a square");
            Console.ReadLine();
        }
    }
}

John is a software developer, who works for Mega Technologies. He is currently under the project of geometric calculations. The program that John has to develop should: Calculate the area of circle. Calculate the volume of the cube.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication7

{



class geo

{

int a, r,area,volume;

public void ca()

{

Console.WriteLine("Enter the radius of circle:");

r = Convert.ToInt32(Console.ReadLine());

area = 22/7 * r * r;

Console.WriteLine("the area of circle:" + area);

}

public void cv()

{

Console.WriteLine("Enter the side of cone:");

a = Convert.ToInt32(Console.ReadLine());

volume = a*a*a;

Console.WriteLine("the volume of cone:" + volume);

}

}

class Program

{

static void Main(string[] args)

{

int s;

Console.WriteLine("Enter 1 for area of circle and 2 for Volume of cone:");

s=Convert.ToInt32(Console.ReadLine());

geo g = new geo();

switch (s)

{

case 1:

g.ca();

break;

case 2:

g.cv();

break;

default:

Console.WriteLine("invalid selection");

break;

}

Console.ReadLine();

}

}

}