forked from OOP-ADF/Task_1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemperatureConvert.java
More file actions
71 lines (41 loc) · 1.25 KB
/
TemperatureConvert.java
File metadata and controls
71 lines (41 loc) · 1.25 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
67
68
69
70
71
//Ranestari Sastriani, 1301154553, IF3907
import java.util.Scanner;
public class TemperatureConvert{
public static void main(String[] args){
Scanner sc= new Scanner(System.in);
double suhuFahrenheit,suhuKelvin,suhuReamur;
Integer menu=0;
System.out.println("=======KONVERSI SUHU========");
System.out.println(" masukan suhu (celcius) : ");
double suhuCelcius= sc.nextDouble();
while(menu==0) {
System.out.println("1. Reamur");
System.out.println("2. Fahrenheit");
System.out.println("3. kelvin");
System.out.println("pilih no : ");
Integer no=sc.nextInt();
if (no==1){
suhuReamur=0.8*suhuCelcius;
System.out.println(suhuReamur+" reamur");
}
else if (no==2){
suhuFahrenheit=(9/5*suhuCelcius)+32;
System.out.println(suhuFahrenheit+" fahrenheit");
}
else if (no==3){
suhuKelvin=suhuCelcius+273;
System.out.println(suhuKelvin+" kelvin");
}
else{
System.out.println("input salah!!!");
}
System.out.println("KONVERSI lagi? 1.ya/2.tidak ");
System.out.println("pilih no :");
Integer ulang=sc.nextInt();
if (ulang == 1)
System.out.println("===KONVERSI SUHU====");
else
System.exit(0);
}
}
}