import java.util.
*;
abstract class shape
{
double x,y;
public void getdata()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the base : ");
x=sc.nextDouble();
System.out.println("Enter the height : ");
y=sc.nextDouble();
}
abstract void area();
}
class rectangle extends shape
{
void area()
{
this.x=x;
this.y=y;
double a=x*y;
System.out.println("area="+a);
}
class triangle extends shape
{
void area()
{
this.x=x;
this.y=y;
double a=0.5*x*y;
System.out.println("area="+a);
}
}
public class a4
{
public static void main(String args[])
{
int o;
while(true)
{
System.out.println("ENTER YOUR CHOPICE \n1.rectangle \n2.triangle
\n3.exit");
Scanner sc1=new Scanner(System.in);
o=sc1.nextInt();
switch (o)
{
case 1:
{
shape s1=new rectangle();
s1.getdata();
s1.area();
break;
}
case 2:
{
shape s2=new triangle();
s2.getdata();
s2.area();
break;
}
case 3:
{
System.out.println("thank you");
System.exit(0);
break;
}
default:
{
System.out.println("Enter appropriate choice :
");
}