class Shape1
{
static double len,br,side;
static double area(double l, double b)
{
len = l;
br = b;
return(len*br);
}
static double area(double s)
{
side = s;
return(side*side);
}
};
class Exp4_1
{
public static void main(String[] args)
{
double ar_rect, ar_sqr;
ar_rect = Shape1.area(15.5,12.4);
ar_sqr = Shape1.area(42.1);
System.out.println("Area of Rectangle : "+ar_rect +" Sq. Units.");
System.out.println("Area of Square : "+ar_sqr +" Sq. Units.");
}
}
No comments:
Post a Comment