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
41 lines (35 loc) · 1.08 KB
/
TemperatureConvert.java
File metadata and controls
41 lines (35 loc) · 1.08 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
/* Nama : Faishal Wafi N
NIM : 1301154222
Kelas : IF-39-12
*/
import java.util.Scanner;
public class TemperatureConvert {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
System.out.print("Masukan suhu : ");
int c = cin.nextInt();
System.out.println("Konvert ke : ");
System.out.println("1. Reamur");
System.out.println("2. Fahrenheit");
System.out.println("3. Kelvin");
System.out.print("Pilihan : ");
int pil = cin.nextInt();
double hasil;
switch (pil) {
case 1:
hasil = c*4/5;
System.out.println("Hasil = "+hasil+" Reamur");
break;
case 2:
hasil = (9/5*c) + 32;
System.out.println("Hasil = "+hasil+" Fahrenheit");
break;
case 3:
hasil = 273 + c;
System.out.println("Hasil = "+hasil+" Kelvin");
break;
default:
break;
}
}
}