This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kalkulator | |
Nilai 1 : <inputA> // 5 | |
Nilai 2 : <inputB> // 2 | |
Pilih Operator: | |
1. Tambah | |
2. Kurang | |
3. Kali | |
4. Bagi | |
Pilihan (1..4) : <inputOperator> // 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Buat sistem lift | |
- ada 20 lantai | |
- posisi pemain ada di lantai `x` | |
- pemain ingin ke lantai `y` | |
Soal: | |
gambarkan alur lift tersebut. | |
Contoh: | |
posisi pemain = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
total roda <= 2 -> lahan parkir sebelah kiri | |
total roda > 2 <=4 -> lahan parkir sebelah kanan | |
total roda > 4 -> basement | |
check here -> https://github.com/swarawan/batch-6-java-basic.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Return string formatted with dot separator and prepended with currency | |
* symbol (IDR). By default will return Rp 0. | |
* | |
* @param defaultOutput Default string to return (with currency prefix) when error happen. | |
*/ | |
@NonNull | |
public static final String formatCurrency(@Nullable BigDecimal input, @NonNull String defaultOutput) { | |
if (input == null) | |
return defaultOutput; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getDurationDate(Date date) { | |
Date today = new Date(); | |
long diff = today.getTime() - date.getTime(); | |
long diffSeconds = diff / 1000 % 60; | |
long diffMinutes = diff / (60 * 1000) % 60; | |
long diffHours = diff / (60 * 60 * 1000) % 24; | |
long diffDays = diff / (24 * 60 * 60 * 1000) % 30; | |
long diffWeeks = diff / (30 * 24 * 60 * 60 * 1000) / 4; | |
long diffMonth = diff / (30 * 24 * 60 * 60 * 1000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DateUtils { | |
public static String getDurationDate(Date date) { | |
Date today = new Date(); | |
long diff = today.getTime() - date.getTime(); | |
long diffSeconds = diff / 1000 % 60; | |
long diffMinutes = diff / (60 * 1000) % 60; | |
long diffHours = diff / (60 * 60 * 1000) % 24; | |
long diffDays = diff / (24 * 60 * 60 * 1000) % 30; | |
long diffWeeks = diff / (30 * 24 * 60 * 60 * 1000) / 4; |
NewerOlder