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
61 lines (49 loc) · 1.53 KB
/
TemperatureConvert.java
File metadata and controls
61 lines (49 loc) · 1.53 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
51
52
53
54
55
56
57
58
59
60
61
/*
* 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.
*/
//Rinaldy Achmad Fauzy
//1301154357
//IF 39-07
package temperatureconvert;
import java.util.Scanner;
/**
*
* @author Rinaldy A
*/
public class TemperatureConvert {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
double celcius,reamur,fahrenheit,kelvin;
// boolean menu;
int i;
Scanner cin= new Scanner(System.in);
System.out.print("Masukkan Suhu dalam Celcius: ");
celcius=cin.nextDouble();
reamur=celcius*0.8;
fahrenheit=celcius*1.8+32;
kelvin=celcius+273;
System.out.println("Mau di Koneversikan ke?");
System.out.println("1.Reamur");
System.out.println("2.Fahrenheit");
System.out.println("3.Kelvin");
// menu=cin.nextBoolean();
i=cin.nextInt();
if (i==1) {
System.out.println("Suhu di dalam Reamur adalah: "+reamur+" R");
}
else if (i==2){
System.out.println("Suhu di dalam Fahrenheit adalah: "+fahrenheit+"F");
}
else if (i==3){
System.out.println("Suhu di dalam Kelvin adalah: "+kelvin+"K");
}
else {
System.out.println("TETOT! Maaf inputan tidak ada... ");
}
}
}