## Java program to calculate area

### Program to calculate area in Java

import java.util.*;

//itvoyagers.in

class Area

{

float a;

public void area_Circle(float r)

{

a = r*r*3.14f;

System.out.println("nArea of Circle is : "+a);

}

public void area_Square(float s)

{

a = s*s;

System.out.println("nArea of Square is : "+a);

}

//itvoyagers.in

public void area_Rectangle(float l, float b)

{

a = l*b;

System.out.println("nArea of Rectangle is : "+a);

}

public void area_Triangle(float b, float h)

{

a = b*h;

System.out.println("nArea of Triangle is : "+a);

}

}

//itvoyagers.in

class FindArea

{

public static void main(String agr[])

{

float radius,side,length,breadth,base,height;

Scanner in = new Scanner(System.in);

//you can accept values from user

radius = 6;

side = 10;

length = 5;

breadth = 12;

base = 8;

height = 7;

Area area = new Area();

area.area_Circle(radius);

area.area_Square(side);

area.area_Rectangle(length,breadth);

area.area_Triangle(base,height);

}

}

**Output :**

Area of Circle is : 113.04

Area of Square is : 100.0

Area of Rectangle is : 60.0

Area of Triangle is : 56.0

### PRACTICALS/PRACTICE PROGRAM IN Java

### CHECKOUT OTHER RELATED TOPICS

We are aiming to explain all concepts of Java in easiest terms as possible.

ITVoyagers

Author