forked from OOP-ADF/Task_1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTemperatureConvert.java
100 lines (88 loc) · 3.58 KB
/
TemperatureConvert.java
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Jeremiah Hasudungan IF 39-07 1301154287
/*
* 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 Jeremi
*/
public class TemperaturConvert {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Scanner scanC = new Scanner(System.in);
Scanner scanF = new Scanner(System.in);
Scanner scanR = new Scanner(System.in);
Scanner scanP = new Scanner(System.in);
Scanner scanP2 = new Scanner(System.in);
Scanner scanP3 = new Scanner(System.in);
Scanner scanP4 = new Scanner(System.in);
System.out.println(" Pilih Suhu yang akan di masukan ");
System.out.println(" 1. Celcius ");
System.out.println(" 2. Reamur ");
System.out.println(" 3. Fahrenheit ");
int pil = scanP.nextInt();
switch (pil){
case 1 :
System.out.println(" Masukan Derajat Celcius ");
double cel = scanC.nextDouble();
System.out.println(" Kemana akan dikonvert ");
System.out.println(" 1. Reamur ");
System.out.println(" 2. Fahrenheit ");
int pil2 = scanP2.nextInt();
switch (pil2){
case 1 :
double hasilReamur1 = cel*0.8;
System.out.println(hasilReamur1 + " Reamur ");
break;
case 2 :
double hasilFahrenheit1 = (cel*1.8)+32;
System.out.println(hasilFahrenheit1 + " Fahreinheit ");
break;
}
break;
case 2 :
System.out.println(" Masukan Derajat Reamur ");
double rea = scanR.nextDouble();
System.out.println(" Kemana akan dikonvert ");
System.out.println(" 1. Celcius ");
System.out.println(" 2. Fahreinheit ");
int pil3 = scanP3.nextInt();
switch (pil3) {
case 1 :
double hasilCelcius1 = rea/0.8;
System.out.println(hasilCelcius1 + " Celcius ");
break;
case 2 :
double hasilFahrenheit2 = (rea*2.25)+32;
System.out.println(hasilFahrenheit2 + " Fahreinheit ");
break;
}
break;
case 3 :
System.out.println(" Masukan Derajat Fahrenheit ");
double F = scanF.nextDouble();
System.out.println(" Kemana akan dikonvert ");
System.out.println(" 1. Celcius ");
System.out.println(" 2. Fahreinheit ");
int pil4 = scanP4.nextInt();
switch (pil4) {
case 1 :
double hasilCelcius2 = (F-32)/1.8;
System.out.println(hasilCelcius2 + " Celcius ");
break;
case 2 :
double hasilReamur2 = (F-32)/2.25;
System.out.println(hasilReamur2 + " Reamur ");
break;
}
break;
}
}
}