diff --git a/BubbleSort.java b/BubbleSort.java new file mode 100644 index 0000000..c7973af --- /dev/null +++ b/BubbleSort.java @@ -0,0 +1,30 @@ +public class BubbleSort{ + public static void main(String[] args){ + + int total= args.length; + int angka[],temp; + angka= new int[100]; + + for(int i=0;iangka[j+1]){ + temp = angka[j]; + angka[j] = angka[j+1]; + angka[j+1] = temp; + } + } + } + + for(int i=0;i1){ + return n*(n-1); + } + return 1; + } +} +// +//1-20 e +//21-40 d +//41-60 c +//61-80 b +//81-100 a \ No newline at end of file diff --git a/Month.java b/Month.java new file mode 100644 index 0000000..b0783b8 --- /dev/null +++ b/Month.java @@ -0,0 +1,50 @@ +public class Month { + public static void main(String[] args){ + + if(args.length!=2){ + System.out.println("Input bulan dan tahun!"); + } + + int bulan= Integer.parseInt(args[0]); + int tahun= Integer.parseInt(args[1]); + switch (bulan) { + case 1 :System.out.println("Bulan Januari!"); + break; + case 2 : + if(tahun%4==0 && tahun%100!=0 || year%400==0){ + System.out.println("Bulan Februari punya 29 hari!"); + }else{ + System.out.println("Bulan Februari punya 28 hari!"); + } + break; + case 3 :System.out.println("Bulan Maret!"); + break; + case 4 :System.out.println("Bulan April!"); + break; + case 5 :System.out.println("Bulan Mei!"); + break; + case 6 :System.out.println("Bulan Juni!"); + break; + case 7 :System.out.println("Bulan Juli!"); + break; + case 8 :System.out.println("Bulan Agustus!"); + break; + case 9 :System.out.println("Bulan September!"); + break; + case 10 :System.out.println("Bulan Oktober!"); + break; + case 11 :System.out.println("Bulan November!"); + break; + case 12 :System.out.println("Bulan Desember!"); + break; + default:System.out.println("Input Bulan!"); + break; + } + } +} +// +//1-20 e +//21-40 d +//41-60 c +//61-80 b +//81-100 a \ No newline at end of file diff --git a/Score.java b/Score.java new file mode 100644 index 0000000..6841bdc --- /dev/null +++ b/Score.java @@ -0,0 +1,31 @@ +public class Score { + public static void main(String[] args){ + System.out.println("Hello World !"); + + //KALENDAR + if(args.length!=1){ + System.out.println("Input angka!"); + } + + int score= Integer.parseInt(args[0]); + if(score>80){ + System.out.println("Nilai A"); + }else if(score>60){ + System.out.println("Nilai B"); + }else if(score>40 ){ + System.out.println("Nilai C"); + }else if(score>20){ + System.out.println("Nilai D"); + }else{ + System.out.println("Nilai E"); + } + + } + +} +// +//1-20 e +//21-40 d +//41-60 c +//61-80 b +//81-100 a \ No newline at end of file diff --git a/TotalDays.java b/TotalDays.java new file mode 100644 index 0000000..86e4521 --- /dev/null +++ b/TotalDays.java @@ -0,0 +1,62 @@ +public class TotalDays { + public static void main(String[] args){ + + if(args.length!=2){ + System.out.println("Input bulan dan tahun!"); + } + + int bulan= Integer.parseInt(args[0]); + int tahun= Integer.parseInt(args[1]); + + switch (bulan) { + case 1: case 3: case 5: case 7: case 8 : case 10 : case 12: System.out.println("punya 31 hari!"); break; + case 4: case 6: case 9: case 11 : System.out.println("punya 30 hari!"); break; + case 2 : + if(tahun%4==0 && tahun%100!=0 || tahun%400==0){ + System.out.println("punya 29 hari!"); + }else{ + System.out.println("punya 28 hari!"); + } + } + + switch (bulan) { + case 1 :System.out.println("Bulan Januari punya 30 hari!"); + break; + case 2 : + if(tahun%4==0 && tahun%100!=0 || tahun%400==0){ + System.out.println("Bulan Februari punya 29 hari!"); + }else{ + System.out.println("Bulan Februari punya 28 hari!"); + } + break; + case 3 :System.out.println("Bulan Maret punya 31 hari!"); + break; + case 4 :System.out.println("Bulan April punya 30 hari!"); + break; + case 5 :System.out.println("Bulan Mei punya 31 hari !"); + break; + case 6 :System.out.println("Bulan Juni punya 30 hari!"); + break; + case 7 :System.out.println("Bulan Juli punya 31 hari!"); + break; + case 8 :System.out.println("Bulan Agustus punya 31 hari!"); + break; + case 9 :System.out.println("Bulan September punya 30 hari!"); + break; + case 10 :System.out.println("Bulan Oktober punya 31 hari!"); + break; + case 11 :System.out.println("Bulan November punya 30 hari!"); + break; + case 12 :System.out.println("Bulan Desember punya 31 hari!"); + break; + default:System.out.println("Input Bulan dan hari!"); + break; + } + } +} +// +//1-20 e +//21-40 d +//41-60 c +//61-80 b +//81-100 a \ No newline at end of file