forked from Unicorn-Dev-Community/Program-and-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindArea.java
60 lines (48 loc) · 1.56 KB
/
FindArea.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/*
==================================================================================================================================
Date: 26/Sep/2020
Author: Amal Shibu
Languages Used: Java
Session: Online Class
Subject: Oops lab
Error: Null
Warnings:Null
==================================================================================================================================
*/
//Finding Area of Circle,Triangle,Reactangle.
import java.util.Scanner;
class FindArea
{
public static void main(String amal[])
{
Scanner input=new Scanner(System.in);
System.out.println("Enter radius of the Cirlcle: ");
float rad=input.nextFloat();
System.out.println("Enter the base length of the Triangle: ");
double blength=input.nextDouble();
System.out.println("Enter the height of the triangle: ");
double height=input.nextDouble();
System.out.println("Enter the length of the rectangle: ");
int length=input.nextInt();
System.out.println("Enter the length of the rectangle: ");
int breadth=input.nextInt();
System.out.println("Area of the Circle: "+Area(rad));
System.out.println("Area of triangle : "+Area(blength,height));
System.out.println("Area of the rectangle: "+Area(length,breadth));
}
public static float Area(float rad)
{
float ar=(3.14F*rad*rad);
return ar;
}
public static double Area(double blength,double height)
{
double ar=(0.5*blength*height);
return ar;
}
public static int Area(int length,int breadth)
{
int ar=(length*breadth);
return ar;
}
}