-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeven1.java
More file actions
56 lines (46 loc) · 1.57 KB
/
Seven1.java
File metadata and controls
56 lines (46 loc) · 1.57 KB
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
import java.util.Scanner;
class Seven1
{
public static void main(String[] Strings)
{
Scanner input = new Scanner(System.in);
int figure;
double radius, length, width, area, circumference, height, perimeter, base_length;
System.out.println("\t1)Circle\n\t2)Rectangle\n\t3)Right-angled_Triangle");
System.out.print("Enter your figure:");
figure = input.nextInt();
if(figure == 1)
{
System.out.print("Enter the radius:");
radius = input.nextDouble();
area = 3.142 * radius * radius;
circumference = 3.142 * 2 *(radius + radius);
System.out.println("Area =" + area);
System.out.println("Circumference =" + circumference);
}
else if(figure == 2)
{
System.out.print("Enter the length:");
length = input.nextDouble();
System.out.print("Enter the width:");
width = input.nextDouble();
area = length * width;
perimeter = 2 * (length + width);
System.out.println("Area =" + area);
System.out.println("Perimeter =" + perimeter);
}
else if(figure == 3)
{
System.out.print("Enter the height:");
height = input.nextDouble();
System.out.print("Enter the base_length:");
base_length = input.nextDouble();
area = 0.5 * base_length * height;
System.out.println("Area =" + area);
}
else
{
System.out.println("Invalid figure!!");
}
}
}