Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

import java.util.

*;
class FO
{
double Area(double r)
{
double o;
o = (3.14)*r*r;
return o;
}
double Area(double a,double b)
{
double c;
c= a*b;
return c;
}
int Area(int h,int d)
{
int g;
g= (h*d)/2;
return g;
}
int Area(int s)
{
int k;
k = s*s;
return k;
}
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
double r,a,b;int s;
int h,d;
System.out.println("Enter the Radius of circle");
r= sc.nextDouble();
System.out.println("Enter the length and breadth to find area of
rectangle");
a= sc.nextDouble();
b= sc.nextDouble();
System.out.println("Enter the length and breadth to find area of
triangle");
h= sc.nextInt();
d= sc.nextInt();
System.out.println("Enter the side of square to find area");
s= sc.nextInt();
FO obj = new FO();
System.out.println("Area of Circle = "+obj.Area(r));
System.out.println("Area of Rectangle = "+obj.Area(a,b));
System.out.println("Area of Triangle = "+obj.Area(h,d));
System.out.println("Area of Square = "+obj.Area(s));
}
}

You might also like