abstract class shape
{
double area;
final double phi=22.0/7.0;
abstract double Area();
}
class Rectangle extends shape
{
double length,breadth;
Rectangle(double x,double y)
{
length=x;
breadth=y;
}
double Area()
{
area=length*breadth;
return area;
}
}
class Circle extends shape
{
double radius;
Circle(double r)
{
radius =r;
}
double Area()
{
area = phi*radius*radius;
return area;
}
}
class Abstractdemo
{
public static void main(String args[])
{
Rectangle rec = new Rectangle(6.0,4.0);
double ar;
ar=rec.Area();
System.out.println(+ar);
Circle cr = new Circle(5.25);
ar = cr.Area();
System.out.println(+ar);
}
}
{
double area;
final double phi=22.0/7.0;
abstract double Area();
}
class Rectangle extends shape
{
double length,breadth;
Rectangle(double x,double y)
{
length=x;
breadth=y;
}
double Area()
{
area=length*breadth;
return area;
}
}
class Circle extends shape
{
double radius;
Circle(double r)
{
radius =r;
}
double Area()
{
area = phi*radius*radius;
return area;
}
}
class Abstractdemo
{
public static void main(String args[])
{
Rectangle rec = new Rectangle(6.0,4.0);
double ar;
ar=rec.Area();
System.out.println(+ar);
Circle cr = new Circle(5.25);
ar = cr.Area();
System.out.println(+ar);
}
}