You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Write a separate class TestCircle with a main() method and test the Circle class methods.create a circle objects and assign it to reference variables obj
10
+
11
+
Input Format
12
+
13
+
radius of circile
14
+
15
+
Constraints
16
+
17
+
radius>0
18
+
19
+
Output Format
20
+
21
+
prints the result of Area,circumfrence and perimeter of circle.
22
+
23
+
Sample Input 0
24
+
25
+
2
26
+
Sample Output 0
27
+
28
+
Area of circle:12.566370614359172
29
+
Perimeter of circle:12.566370614359172
30
+
Circumference of circle:12.566370614359172
31
+
*/
32
+
importjava.io.*;
33
+
importjava.util.*;
34
+
classCircle
35
+
{
36
+
doubleradius;
37
+
Circle(doubler)
38
+
{radius = r;}
39
+
voidarea()
40
+
{
41
+
System.out.println("Area of circle:"+3.141592653589793*radius*radius);
42
+
}
43
+
voidcircumfrence()
44
+
{
45
+
System.out.println("Circumference of circle:"+3.141592653589793*2*radius);
46
+
}
47
+
voidparimeter()
48
+
{
49
+
System.out.println("Perimeter of circle:"+3.141592653589793*2*radius);
50
+
}
51
+
}
52
+
publicclassSolution {
53
+
54
+
publicstaticvoidmain(String[] args) {
55
+
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
0 commit comments