-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLingkaran.java
More file actions
67 lines (48 loc) · 1.66 KB
/
Lingkaran.java
File metadata and controls
67 lines (48 loc) · 1.66 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
57
58
59
60
61
62
63
64
65
66
import java.io.File;
import java.io.IOException;
import java.util.Scanner;
public class Lingkaran extends Bangunruang {
interface myInterface{
float getPiValue();
}
// private float phi;
// public Lingkaran(){
// this.phi = 3.14f;
// }
// public float getfloatPrivate(){
// return this.phi;
// };
@Override
void luas() {
do{
Scanner input = new Scanner(System.in);
System.out.print("Masukkan nilai radius = ");
s1 = input.nextInt();
myInterface Ref;
Ref = () -> 3.14f;
hasil = Ref.getPiValue()*s1*s1;
FileHandling.createfile("luas_lingkaran");
FileHandling.writefile("luas_lingkaran" , hasil);
System.out.print("Masih mau mencari luas lingkaran? (Y/N) = ");
ans = input.next().charAt(0);
}
while (ans == 'Y');
}
// TODO Auto-generated method stub
@Override
void keliling() {
do{
Scanner input = new Scanner(System.in);
System.out.print("Masukkan nilai radius = ");
s1 = input.nextInt();
myInterface Ref;
Ref = () -> 3.14f;
hasil = Ref.getPiValue()*2*s1;
FileHandling.createfile("keliling_lingkaran");
FileHandling.writefile("keliling_lingkaran" , hasil);
System.out.print("Masih mau mencari keliling lingkaran? (Y/N) = ");
ans = input.next().charAt(0);
} while (ans == 'Y');
}
}
// TODO Auto-generated method stub