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
35 lines (30 loc) · 855 Bytes
/
TemperatureConvert.java
File metadata and controls
35 lines (30 loc) · 855 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
31
32
33
34
35
/**
* Nama: Herica Bunga Maharani
* Nim: 1301154572
* 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("Masukkan Suhu (Celcius): ");
int suhu = cin.nextInt();
System.out.println("-Konversi Ke-");
System.out.println("1. Reamur");
System.out.println("2. Fahrenheit");
System.out.println("3. Kelvin");
System.out.print("Pilih: ");
int menu = cin.nextInt();
double result;
if (menu==1){
result = 0.8*suhu;
System.out.println(result+"Reamur"); }
else if (menu==2){
result = (1.8*suhu) + 32;
System.out.println(result+"Fahrenheit");
} else{
result = 273+suhu;
System.out.println(result+"Kelvin");
}
}
}