Areassw
Areassw
*;
class Area
{
public static void main(String args[])
{
float r,s,l,b;
int ch;
Scanner S=new Scanner(System.in);
System.out.println("\n1.Circle \n2.Rectangle \n3.Square");
System.out.println("\nEnter your Choice");
ch=S.nextInt();
switch(ch)
{
case 1:
double a;
double pi=3.14;
System.out.println("Enter the Radius of the Circle");
r=S.nextFloat();
a=pi*r*r;
System.out.println("Area of the Circle ="+a);
break;
case 2:
double ar;
System.out.println("Enter the Length and Breadth of the Rectangle");
l=S.nextFloat();
b=S.nextFloat();
ar=l*b;
System.out.println("Area of the Rectangle ="+ar);
break;
case 3:
double arr;
System.out.println("Enter the Side of the Square");
s=S.nextFloat();
arr=s*s;
System.out.println("Area of the Square ="+arr);
break;
default:
System.out.println("\nInvalid Choice");
}
}
}