-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDoWhileCuti10.java
34 lines (32 loc) · 1.28 KB
/
DoWhileCuti10.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
import java.util.Scanner;
public class DoWhileCuti10 {
public static void main(String[] args) {
Scanner input10 = new Scanner(System.in);
int jatahCuti, jumlahHari;
String konfirmasi;
System.out.println("Masukkan jatah cuti: ");
jatahCuti = input10.nextInt();
do {
System.out.println("Apakah inging mengambil cuti (y/n)");
konfirmasi = input10.next();
if (konfirmasi.equalsIgnoreCase("y")) {
System.out.println("Mauskkan jumlah hari cuti anda: ");
jumlahHari = input10.nextInt();
if (jumlahHari <= jatahCuti) {
jatahCuti -= jumlahHari;
System.out.println("Sisa jatah cuti anda :" + jatahCuti);
} else {
System.out.println("Jatah cuti kurang");
System.out.println("Apakah ingin mencoba lagi (y/n)");
konfirmasi = input10.next();
if (!konfirmasi.equalsIgnoreCase("y")) {
break;
}
}
} else if (konfirmasi.equalsIgnoreCase("n")) {
break;
} else {
}
} while (jatahCuti > 0);
}
}