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
40 lines (38 loc) · 1.08 KB
/
TemperatureConvert.java
File metadata and controls
40 lines (38 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
/*
* Lailis Sa'adah
* 1301154502
* If39-12
*/
package pkg1301154502_lailissaadah_if3912_task1;
/**
*
* @author user
*/
import java.util.Scanner;
public class TemperatureConvert {
public static void main (String [] args){
Scanner input = new Scanner(System.in);
System.out.print("masukkan nilai celcius: ");
double celcius = input.nextDouble();
System.out.println(" Convert to ");
System.out.println(" 1.fahrenheit");
System.out.println(" 2. reamur ");
System.out.println(" 3.kelvin ");
System.out.print(" pilih : ");
int pilih = input.nextInt();
double fahrenheit,reamur,kelvin;
if (pilih == 1){
fahrenheit= celcius*1.8+32;
System.out.println("fahrenheit :"+fahrenheit);
}
else if (pilih == 2){
reamur= celcius*0.8;
System.out.println("reamur :"+reamur);
}
else if (pilih == 3){
kelvin=celcius+273.15;
System.out.println("kelvin :"+kelvin);
} else
System.out.println("Pilihan anda tidak ada");
}
}