Akshay Welekar
asked on
type expected error
using System;
using System.Collections.Generic ;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Configuration;
using System.Text.RegularExpress ions;
namespace enumeration
{
class Area
{
public enum Shape
{
Circle,
Square
}
public void AreaShape(int x, Shape shape)
{
double area;
switch (shape)
{
case Shape.Circle:
area = Math.PI * x * x;
Console.WriteLine("Circle Area= " + area);
break;
case Shape.Square:
area = x * x;
Console.WriteLine("Square Area= " + area);
break;
default:
Console.WriteLine("Invalid Input"); break;
}
}
}
class EnumTest:
{
public static void Main(string[] args)
{
Area area= new Area();
area.AreaShape(15,Area.Sha pe.Circle) ;
area.AreaShape(15,Area.Sha pe.Square) ;
area.AreaShape(15,(Area.Sh ape)1);
area.AreaShape(15,(Area.Sh ape)10);
}
}
}
using System.Collections.Generic
using System.Linq;
using System.Text;
using System.Configuration;
using System.Configuration;
using System.Text.RegularExpress
namespace enumeration
{
class Area
{
public enum Shape
{
Circle,
Square
}
public void AreaShape(int x, Shape shape)
{
double area;
switch (shape)
{
case Shape.Circle:
area = Math.PI * x * x;
Console.WriteLine("Circle Area= " + area);
break;
case Shape.Square:
area = x * x;
Console.WriteLine("Square Area= " + area);
break;
default:
Console.WriteLine("Invalid
}
}
}
class EnumTest:
{
public static void Main(string[] args)
{
Area area= new Area();
area.AreaShape(15,Area.Sha
area.AreaShape(15,Area.Sha
area.AreaShape(15,(Area.Sh
area.AreaShape(15,(Area.Sh
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Two problems in code solved