import java.io.*; interface Shape //interface {
{
float fPi=3.14f;
public void fnRead();
public void fnArea();
public void fnShow();
class Rectangle implements Shape //implementation class
int iLength, iBreadth; float ,Area;
public void fnRead()
DatalnputStream d=new DatalnputStream(System.in);
try
{
System.out.print("Enter the length : ");
iLength=Integer.parseInt(d.readLine());
System.out.print("Enter the breadth : ");
iBreadth=Integer.parseInt(d.readLine());
}
catch(Exception e)
{
}
public void fnArea()
{ fArea=iLength*iBreadth; }
public void fnShow()
{System.out.println("Area of the rectangle : " + fArea);
}
class Square implements Shape //implementation class
int iSide; float, fArea;
public void fnRead()
{
try
{
DatalnputStream d2=new DatalnputStream(System.in);
System.out.print("Enter the length of the side: ");
iSide=Integer.parseInt(d2.1eadLine());
} catch(Exception e) {}
public void fnArea()
{ fArea=iSide*iSide; }
public void fnShow()
{
System.out.println("Area of the square: " fArea);
}
class Square implements Shape //implementation class
int iSide; float, fArea;
public void fnRead()
{
try
{
DatalnputStream d2=new DatalnputStream(System.in);
System.out.print("Enter the length of the side: ");
iSide=Integer.parseInt(d2.1eadLine());
} catch(Exception e) {}
public void fnArea()
{ fArea=iSide*iSide; }
public void fnShow()
{
System.out.println("Area of the square: " fArea);
}
class circle implements Shape //implementation class
int radius; float, fArea;
public void fnRead()
{
try
{
DatalnputStream d2=new DatalnputStream(System.in);
System.out.print("Enter the radius of the circle: ");
radius=Integer.parseInt(d2.1eadLine());
} catch(Exception e) {}
public void fnArea()
{ fArea=2*float*radius*radius; }
public void fnShow()
{
System.out.println("Area of the circle: " fArea);
}
class ShapeInterface //main class
public static void main(String[] a)throws I0Exception
{
int iChoice;
Shape sObject;
String s; DatalnputStream in=new DataInputStream(System.in);
do
{
System.out.println("Area Calculation \n");
System.out.println("1 --> Rectangle\n2 --> Square\n3 --> circle\n2 --> Exist");
System.out.print("Enter ur choice : ");
iChoice=Integer.parseInt(in.readLine());
switch(iChoice)
{
case 1:
{
Rectangle rObject=new Rectangle();
sObject=rObject; sObject.fnRead();
sObject.fnArea();
sObject.fnShow();
break;
}
case 2:
{
Square sq0bject=new Square();
sObject=sq0bject;
sObject.fnRead();
sObject.fnArea();
sObject.fnShow();
break; }
case 3:
{
circle crl0bject=new circle();
cObject=crl0bject;
sOcObjectbject.fnRead();
cObject.fnArea();
cObject.fnShow();
break; }
case 4:
{ System.exit(0);
break; } //end of switch
System.out.println("Do you want to continue? Press y for Yes or Press N for No"); s=in.readLine(); }
while(s.equals("y"));
}
}