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 (37 loc) · 969 Bytes
/
Copy pathTemperatureConvert.java
File metadata and controls
41 lines (37 loc) · 969 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
36
37
38
39
40
41
/*
/*Azahra Kartika-1301154460-IF-39-12
*/
package primernumber;
/**
*
* @author Acer
*/
import java.util.Scanner;
public class Temperature {
public static void main (String[] args){
Scanner cin = new Scanner (System.in);
System.out.print("Masukkan suhu = ");
int suhu = cin.nextInt();
System.out.println("1. Reamur ");
System.out.println("2. Fahrenheit ");
System.out.println("3. Kelvin ");
System.out.println("Convert ke = ");
int pil = cin.nextInt();
double hasil;
hasil =0;
if(pil == 1)
{
hasil = 0.8 *suhu;
System.out.print("Hasil ="+hasil+"Reamur");
}
else if (pil == 2)
{
hasil = (9/5*suhu)+32;
System.out.print("Hasil = "+hasil+"Fahrenheit");
}
else
{hasil = 273+suhu;
System.out.print("Hasil = "+hasil+"Kelvin");
}
}
}