Code:
import java.util.*;
class area
{
void all(int a)
{
int k;
k=a*a;
System.out.println("The Area of the Square is "+k);
}
void all(int b,int c)
{
int k;
k=b*c;
System.out.println("The Area of the Rectangle is "+k);
}
}
class reca
{
public static void main(String args[])
{
int a,b,c;
Scanner in=new Scanner(System.in);
System.out.print("Sides of Square= ");
a=in.nextInt();
area obj=new area();
obj.all(a);
System.out.print("Height of rectangle= ");
b=in.nextInt();
System.out.print("Breadth of rectangle= ");
c=in.nextInt();
obj.all(b,c);
}
}
No comments:
Post a Comment