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
50 lines (46 loc) · 1.68 KB
/
TemperatureConvert.java
File metadata and controls
50 lines (46 loc) · 1.68 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
42
43
44
45
46
47
48
49
50
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
* Nama : Afif Darmawan
* NIM : 1301154133
* Kelas: IF 39-07
*/
package tugas1;
import java.util.Scanner;
//import java.io
/**
*
* @author acer
*/
public class No3 {
public static void main(String[] args){
Scanner input= new Scanner(System.in);
double celcius, hasilfahrenheit, hasilkelvin, hasilreamur;
System.out.print("Masukkan Suhu Dalam Celcius : ");
celcius = input.nextInt();
System.out.println("");
System.out.println("1. Fahrenheit");
System.out.println("2. Kelvin");
System.out.println("3. Reamur");
System.out.println("Masukkan Pilihan Perubahan Suhu");
int pilih = input.nextInt();
System.out.println("");
switch(pilih){
case 1:
hasilfahrenheit = (celcius*9/5)+32;
System.out.println(celcius+"Celcius = "+ hasilfahrenheit+"Fahrenheit");
break;
case 2:
hasilkelvin = (celcius+273.15);
System.out.println(celcius +"Celcius ="+ hasilkelvin +"Kelvin");
break;
case 3:
hasilreamur = celcius * 4/5;
System.out.println(celcius +"Celcius ="+ hasilreamur +"Reamur");
break;
default:
System.out.println("Pilihan Yang Anda Masukkan Tidak Benar");
}
}
}