Created
July 13, 2017 15:45
-
-
Save perdanafm/9831e8c86f0bbe48560e36026f6662bd to your computer and use it in GitHub Desktop.
Rekrutmen Asprak IMA
Perdana Faishal Mulhaq
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | |
<output url="file://$PROJECT_DIR$/out" /> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<project version="4"> | |
<component name="ProjectModuleManager"> | |
<modules> | |
<module fileurl="file://$PROJECT_DIR$/RekrutmenAsprak.iml" filepath="$PROJECT_DIR$/RekrutmenAsprak.iml" /> | |
</modules> | |
</component> | |
</project> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<module type="JAVA_MODULE" version="4"> | |
<component name="NewModuleRootManager" inherit-compiler-output="true"> | |
<exclude-output /> | |
<content url="file://$MODULE_DIR$"> | |
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | |
</content> | |
<orderEntry type="inheritedJdk" /> | |
<orderEntry type="sourceFolder" forTests="false" /> | |
</component> | |
</module> |
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
/** | |
* Created by Faishal on 12/07/2017. | |
*/ | |
//KALO BISA DIPISAH PERPROJECT// | |
import java.util.Scanner; | |
public class Nomer1 { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
System.out.println("Program Pengecekan Kata Sifat Palindrom "); | |
boolean trigger = false; | |
do { | |
System.out.print("Masukan Kata - - - (Lower Case/Upper Case Semua) : "); | |
String kata = input.next(); | |
int panjang = kata.length(); | |
int pivot = 0; | |
for (int i = 0; i < kata.length(); i++) { | |
if (kata.charAt(i) == kata.charAt(panjang - 1)) { | |
panjang -= 1; | |
pivot += 1; | |
} else { | |
break; | |
} | |
} | |
if (pivot == kata.length()) { | |
System.out.println("True"); | |
} else | |
System.out.println("False"); | |
boolean trigger2 = false; | |
while (trigger2==false) { | |
System.out.println("Lagi ? (y/n) : "); | |
String jwb = input.next(); | |
if (jwb.equalsIgnoreCase("y")) { | |
trigger = false; | |
trigger2 = true; | |
} else if (jwb.equalsIgnoreCase("n")) { | |
trigger = true; | |
trigger2 = true; | |
} else | |
System.out.println("Salah Memasukan Huruf !"); | |
} | |
}while (trigger==false); | |
} | |
} |
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
/** | |
* Created by Faishal on 12/07/2017. | |
*/ | |
import java.util.Scanner; | |
public class Nomer2 { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
int nomor[] = new int[9999]; | |
int nilai[] = new int[9999]; | |
String nama[] = new String[9999]; | |
int a=0; | |
boolean trigger = false; | |
do { | |
System.out.print("Masukan Nomor : "); | |
nomor[a] = input.nextInt(); | |
if (nomor[a] == 9999){ | |
trigger = true; | |
break; | |
} | |
System.out.print("Masukan Nama : "); | |
nama[a] = input.next(); | |
System.out.print("Masukan Nilai : "); | |
nilai[a] = input.nextInt(); | |
System.out.println("Data Terinput -- *** "); | |
System.out.println("JIKA INGIN KELUAR. MASUKAN 9999 di NOMOR"); | |
System.out.println(); | |
a++; | |
} while (trigger==false); | |
int juara1[] = new int[9999]; | |
int juara2[] = new int[9999]; | |
int juara3[] = new int[9999]; | |
int max=0; | |
for (int i=0; i<a; i++){ | |
if (nilai[i]>=max){ | |
max = nilai[i]; | |
} | |
} | |
System.out.println("-------"); | |
System.out.println("Juara 1"); | |
for (int i=0; i<a; i++){ | |
if (nilai[i] == max){ | |
juara1[i] = nilai[i]; | |
System.out.print("Nilai : "+juara1[i]); | |
nilai[i]=0; | |
System.out.println(" Nama : "+nama[i]); | |
} | |
} | |
max=0; | |
System.out.println("-------"); | |
System.out.println("Juara 2"); | |
for (int i=0; i<a; i++){ | |
if (nilai[i]>=max){ | |
max = nilai[i]; | |
} | |
} | |
for (int i=0; i<a; i++){ | |
if (nilai[i] == max){ | |
juara2[i] = nilai[i]; | |
System.out.print("Nilai : "+juara1[i]); | |
nilai[i]=0; | |
System.out.println(" Nama : "+nama[i]); | |
} | |
} | |
max=0; | |
System.out.println("-------"); | |
System.out.println("Juara 3"); | |
for (int i=0; i<a; i++){ | |
if (nilai[i]>=max){ | |
max = nilai[i]; | |
} | |
} | |
for (int i=0; i<a; i++){ | |
if (nilai[i] == max){ | |
juara3[i] = nilai[i]; | |
System.out.print("Nilai : "+juara1[i]); | |
nilai[i]=0; | |
System.out.println(" Nama : "+nama[i]); | |
} | |
} | |
} | |
} |
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
/** | |
* Created by Faishal on 12/07/2017. | |
*/ | |
import java.util.Scanner; | |
//MASIH PERLU REVISI BANYAK!!!// | |
public class Nomer3 { | |
public static void bubbleSort(int[] numArray) { | |
int n = numArray.length; | |
int temp = 0; | |
for (int i = 0; i < n; i++) { | |
for (int j = 1; j < (n - i); j++) { | |
if (numArray[j - 1] > numArray[j]) { | |
temp = numArray[j - 1]; | |
numArray[j - 1] = numArray[j]; | |
numArray[j] = temp; | |
} | |
} | |
} | |
} | |
public static void printArray(int[] x) { | |
for(int i=0; i<x.length; i++) | |
System.out.print(x[i] + " "); | |
} | |
public static void main(String[] args) { | |
int[] num = {5,4,3,2,1}; | |
bubbleSort(num); | |
printArray(num); | |
} | |
} | |
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
/** | |
* Created by Faishal on 12/07/2017. | |
*/ | |
import java.util.Scanner; | |
public class Nomer4 { | |
public static void main(String[] args) { | |
Scanner input = new Scanner(System.in); | |
int jum; | |
do { | |
System.out.println("Masukan jumlah array (Max 10) : "); | |
jum = input.nextInt(); | |
if (jum>10){ | |
System.out.println("MAX 10!"); | |
} | |
}while (jum>10); | |
int[] array = new int[10]; | |
int[] arrayHasil = new int[10]; | |
int count = 0; | |
for (int i = 0; i < jum; i++) { | |
System.out.print("Angka - "+(i+1)+" :"); | |
array[i] = input.nextInt(); | |
} | |
for (int i = 0; i < jum; i++) { | |
if (i==jum-1){ | |
arrayHasil[count]=array[i]; | |
System.out.print(arrayHasil[count]); | |
count++; | |
break; | |
} | |
for(int j=(i+1); j<jum; j++){ | |
if (array[i]==array[j] && i!=jum-1){ | |
break; | |
}else if (j == jum-1){ | |
arrayHasil[count] = array[i]; | |
System.out.print(arrayHasil[count]); | |
count++; | |
} | |
} | |
} | |
System.out.println(); | |
System.out.print("Hasil Array = { "); | |
for (int i=0; i<count; i++){ | |
System.out.print(arrayHasil[i]+" , "); | |
} | |
System.out.println("}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment