From 5c6b6039f115b95ce1282f0154caf34554bd8faf Mon Sep 17 00:00:00 2001 From: AlvinFark <40926061+AlvinFark@users.noreply.github.com> Date: Tue, 14 Aug 2018 12:06:48 +0700 Subject: [PATCH] Sesi 1 --- Bubble.java | 28 ++++++++++++++++++++++ BulanTahun.java | 38 +++++++++++++++++++++++++++++ Faktorial.java | 17 +++++++++++++ FaktorialRecursive.java | 23 ++++++++++++++++++ Score.java | 26 ++++++++++++++++++++ SwitchBulan.java | 53 +++++++++++++++++++++++++++++++++++++++++ 6 files changed, 185 insertions(+) create mode 100644 Bubble.java create mode 100644 BulanTahun.java create mode 100644 Faktorial.java create mode 100644 FaktorialRecursive.java create mode 100644 Score.java create mode 100644 SwitchBulan.java diff --git a/Bubble.java b/Bubble.java new file mode 100644 index 0000000..c4115fd --- /dev/null +++ b/Bubble.java @@ -0,0 +1,28 @@ +//import java.util.Scanner; + +public class Bubble { + + public static void main(String[] args){ + + int[] arr = new int[10]; + int tmp = 0; + for (int i=0; iarr[j]){ + tmp = arr[i]; + arr[i] = arr[j]; + arr[j] = tmp; + }; + }; + }; + + for (int i=0; i80) { + System.out.println("A"); + } else if (score>60) { + System.out.println("B"); + } else if (score>40) { + System.out.println("C"); + } else if (score>20) { + System.out.println("D"); + } else { + System.out.println("E"); + } + } +} \ No newline at end of file diff --git a/SwitchBulan.java b/SwitchBulan.java new file mode 100644 index 0000000..5393449 --- /dev/null +++ b/SwitchBulan.java @@ -0,0 +1,53 @@ +import java.util.Scanner; + +public class SwitchBulan { + public static void main(String[] args){ + + int num = Integer.parseInt(args[0]); + + Scanner in = new Scanner(System.in); + + String bulan = "tes"; + + switch (num){ + case 1 : + bulan = "Januari"; + break; + case 2 : + bulan = "Februari"; + break; + case 3 : + bulan = "Maret"; + break; + case 4 : + bulan = "April"; + break; + case 5 : + bulan = "Mei"; + break; + case 6 : + bulan = "Juni"; + break; + case 7 : + bulan = "Juli"; + break; + case 8 : + bulan = "Agustus"; + break; + case 9 : + bulan = "September"; + break; + case 10 : + bulan = "Oktober"; + break; + case 11 : + bulan = "November"; + break; + case 12 : + bulan = "Desember"; + break; + } + + System.out.println(bulan); + } +} \ No newline at end of file