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
31 lines (27 loc) · 984 Bytes
/
TemperatureConvert.java
File metadata and controls
31 lines (27 loc) · 984 Bytes
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
public class TemperatureConvert {
public static void main(String[] args) {
System.out.print("Suhu dalam Celsius: ");
Scanner konversi = new Scanner(System.in);
int k = konversi.nextInt();
System.out.println("1.kelvin: ");
System.out.println("2.reamur: ");
System.out.println("3.fahrenheit: ");
System.out.println("Diubah ke: ");
int pilih = konversi.nextInt();
int suhu;
switch (pilih) {
case 1 :
suhu = k+273;
System.out.println("Konversi Celcius ke Kelvin= " + suhu +" kelvin");
break;
case 2 :
suhu = k*4/5;
System.out.println("Konversi Celcius ke Reamur= " + suhu +" reamur");
break;
case 3 :
suhu = (k*9/5)+32;
System.out.println("Konversi Celcius ke Fahrenheit= " + suhu +" Fahrenheit");
break;
}
}
}