Skip to content

Commit 11446da

Browse files
committed
Experiment5_3
1 parent 7b08a50 commit 11446da

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
interface values {
3+
static float pi = 3.14f;
4+
public float compute(float a,float b);
5+
}
6+
class Rectangle implements values {
7+
public float compute(float a, float b){
8+
return a*b;
9+
}
10+
}
11+
class Circle implements values{
12+
public float compute(float a,float b){
13+
return pi*a*a;
14+
}
15+
}
16+
public class Exp5_3 {
17+
public static void main(String[] args) {
18+
Rectangle obj = new Rectangle();
19+
Circle obj1 = new Circle();
20+
System.out.println(obj.compute(2,4));
21+
System.out.println(obj1.compute(3,4));
22+
23+
}
24+
}

0 commit comments

Comments
 (0)