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 (31 loc) · 971 Bytes
/
TemperatureConvert.java
File metadata and controls
41 lines (31 loc) · 971 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
package javaapplication5;
import java.util.Scanner;
public class Temperature {
public static void main(String[] args) {
Scanner cin = new Scanner(System.in);
double a = 0, b;
int c;
System.out.print("Suhu dalam Celcius : ");
b = cin.nextDouble();
Scanner cinString = new Scanner(System.in);
System.out.println("1.Reamur");
System.out.println("2.Farenheit");
System.out.println("3.Kelvin");
c = cinString.nextInt();
if (c == 1){
b = 0.8*a;
System.out.println("Hasil : " + b );
}
else if (c == 2){
b = (1.8*a) + 32;
System.out.println("Hasil : " + b );
}
else if (c == 3){
b = a + 273;
System.out.println("Hasil : " + c );
}
else{
System.out.println("Input Salah");
}
}
}