There was an error while loading. Please reload this page.
1 parent bcf0f2f commit 024ed93Copy full SHA for 024ed93
1 file changed
TempAir.java
@@ -0,0 +1,30 @@
1
+import java.util.Scanner;
2
+
3
+public class TempAir {
4
+ public static void main(String[] args){
5
+ /* contoh pemakaian IF tiga kasus : wujud air */
6
7
+ /*Kamus*/
8
+ int T;
9
10
+ /*Program*/
11
+ System.out.println("Contoh IF tiga kasus");
12
+ System.out.print("Temperatur (der. C) = ");
13
14
+ //scanner untuk masukan temperatur air
15
+ Scanner scanner = new Scanner(System.in);
16
+ T = scanner.nextInt(); //masukan temperatur air dengan tipe int
17
18
+ //proses pengecekan dengan if
19
+ if (T < 0){
20
+ System.out.println("Wujud air beku " + T);
21
+ }else if ((0 <= T) && (T <= 100))
22
+ {
23
+ System.out.println ("Wujud air cair " + T);
24
+ }
25
+ else if (T > 100)
26
27
+ System.out.println("Wujud air uap/gas " + T);
28
29
30
+}
0 commit comments