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
47 lines (43 loc) · 1.47 KB
/
TemperatureConvert.java
File metadata and controls
47 lines (43 loc) · 1.47 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
/* Nama : Serlii Ratmala Crusita
* Nim : 1301154474
* Kelas : IF 39-12
* 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.
*/
package temperaturconvert;
import java.util.Scanner;
/**
*
* @author Serlii R. Crusita
*/
public class Temperaturconvert {
public static void main(String[] args) {
Scanner celcius = new Scanner(System.in);
System.out.println("Masukkan Suhu Celcius : ");
int cel = celcius.nextInt();
System.out.println("1. Fahrenheit ");
System.out.println("2. Kelvin ");
System.out.println("3. Reamur ");
Scanner input = new Scanner (System.in);
System.out.println("Ingin diubah dalam ? ");
int p = input.nextInt();
int suhu;
switch (p){
case 1 :
suhu = (cel*9/5)+32;
System.out.println(suhu + " Fahrenheit");
break;
case 2 :
suhu = cel + 273;
System.out.println(suhu + " Kelvin");
break;
case 3 :
suhu = cel*4/5;
System.out.println(suhu + " Reamur");
break;
default:
System.out.println("Pilihan yang dimasukkan hasilnya : ");
}
}
}