Program Concatenation dan Shuffle (Kelas 3M)

Program concatenation dan shuffle bagi kelas 3M.

  1. Silahkan menuliskan program concatenation dan shuffle menggunakan bahasa apapun baik Java, C, C++, Pascal, Basic, dan sebagainya di bagian komentar.
  2. Jangan lupa menuliskan nama dan NIM anda.
  3. Ingat perhatikan baik-baik kelas anda, selain program / koding tuliskan hasilnya dari alur program yang anda tulis.

Perhatian : komentar tidak akan ditampilkan sebelum disetujui.

33 Responses

  1. package matdis;

    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class MatDis {

    public static String InputI = JOptionPane.showInputDialog(“Masukkan Masukkan I “);
    public static String InputII = JOptionPane.showInputDialog(“Masukkan Masukkan II “);

    public static void main(String args[]) {

    MatDis coding = new MatDis(); //Construktor
    coding.shuffle(InputI + InputII); //pemanggilan method
    coding.contatination(InputI, InputII); //pemanggilan method

    System.exit(0);
    }

    public void shuffle(String input) {
    List characters = new ArrayList();
    for (char c : input.toCharArray()) {
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() != 0) {
    int masuk = (int) (Math.random() * characters.size());
    output.append(characters.remove(masuk));
    }
    JOptionPane.showMessageDialog(null, “Shuffle :\n”
    + output.toString());
    }

    public void contatination(String input, String input1) {
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concatination :\n”
    + Buffer);

    System.exit(0);
    }
    }

    Nama : Hanif Al Fitroh
    NIM : 09.11.3504
    Kelas : S1.TI.3M

  2. package matdis;

    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class MatDis {

    public static String InputI = JOptionPane.showInputDialog(“Masukkan Masukkan I “);
    public static String InputII = JOptionPane.showInputDialog(“Masukkan Masukkan II “);

    public static void main(String args[]) {

    MatDis coding = new MatDis(); //Construktor
    coding.shuffle(InputI + InputII); //pemanggilan method
    coding.contatination(InputI, InputII); //pemanggilan method

    System.exit(0);
    }

    public void shuffle(String input) {
    List characters = new ArrayList();
    for (char c : input.toCharArray()) {
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() != 0) {
    int masuk = (int) (Math.random() * characters.size());
    output.append(characters.remove(masuk));
    }
    JOptionPane.showMessageDialog(null, “Shuffle :\n”
    + output.toString());
    }

    public void contatination(String input, String input1) {
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concatination :\n”
    + Buffer);

    System.exit(0);
    }
    }

    nama:Khoirul Azwar
    kelas:S1 TI 3M
    NIM:09.11.3482

  3. package matdis;

    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class MatDis {

    public static String InputI = JOptionPane.showInputDialog(“Masukkan Input I “);
    public static String InputII = JOptionPane.showInputDialog(“Masukkan Input II “);

    public static void main(String args[]) {

    MatDis coding = new MatDis(); //Construktor
    coding.shuffle(InputI + InputII); //pemanggilan method
    coding.contatination(InputI, InputII); //pemanggilan method

    System.exit(0);
    }

    public void shuffle(String input) {
    List characters = new ArrayList();
    for (char c : input.toCharArray()) {
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() != 0) {
    int tampung = (int) (Math.random() * characters.size());
    output.append(characters.remove(tampung));
    }
    JOptionPane.showMessageDialog(null, “Shuffle :\n”
    + output.toString());
    }

    public void contatination(String input, String input1) {
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Contatination :\n”
    + Buffer);
    JOptionPane.showMessageDialog (null,”By Rizka Putra Mustofa” +
    “\n09.11.3514”);
    System.exit(0);
    }
    }

    //NAMA : RIZKA PUTRA MUSTOFA
    //NIM :09.11.3514
    //KELAS :S1-TI 3M

  4. /*
    author : m iqbal musthofa
    nim : 09.11.3472
    class : SI TI 3M
    …e-mail : musthofaiqbal41@yahoo.

    — program matematika diskret – mencari shuffle & contatination —
    */
    echo “”;
    echo “”;
    echo “”;
    echo “m iqbal musthofa – 09.11.3472 – S1 TI 3M | Matematika Diskrit”;
    echo “”;
    echo “”;
    echo “”;
    echo ““;
    echo “m iqbal mustofa”;
    echo “”;
    echo “09.11.3472”;
    echo “”;
    echo “S1 TI 3M”;
    echo “”;
    echo “Matematika Diskret”;
    echo “”;
    echo “
    “;
    echo “=======================================”;
    echo “”;

    $proses = $_GET[‘proses’];
    $proses = $_POST[‘submit’];

    if(!isset($proses))
    {
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Kata Pertama”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Kata Kedua”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo ” “;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    }
    else
    {
    //memotong kata
    function potong ($konten, $kata)
    {
    $TMPNEWSPART = array();
    $TMP = explode(” “, $konten);

    for($i=0; $i < $kata; $i++)
    {
    $TMPNEWSPART[$i] = $TMP[$i];
    }
    $NEWSPART = implode(" ", $TMPNEWSPART);

    return $NEWSPART;
    }

    //memotong huruf
    function potong_kata ($kata, $huruf_ke)
    {
    $potong_kata = substr($kata, $huruf_ke, 1);
    return $potong_kata;
    }

    //mencari jumlah char
    function panjang_kata ($kata)
    {
    $panjang_kata = strlen ($kata);
    return $panjang_kata;
    }

    $kata1 = $_POST["kata1"];
    $kata2 = $_POST["kata2"];

    $kata_pertama = potong($kata1, 1);
    $kata_kedua = potong($kata2, 1);

    if ($kata1=='' or $kata2=='')
    {
    echo "Maaf, tolong lengkapi pengisian data,
    klik disini untuk mengulangi.
    “;
    }
    else
    {

    echo “”;
    echo “”;
    echo “”;
    echo “Kata Pertama”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_pertama“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Kata Kedua “;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_kedua“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Contanination”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_pertama$kata_kedua“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Shuffle”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo ““;

    $kata_pertama_mlai = 0;
    $kata_kedua_mlai = 0;

    $panjang_kata_1 = panjang_kata ($kata_pertama);
    $panjang_kata_2 = panjang_kata ($kata_kedua);

    if ( $panjang_kata_1 > $panjang_kata_2 )
    { $jml = $panjang_kata_1; }
    else
    { $jml = $panjang_kata_2; }

    for ( $x = 0; $x < $jml; $x++)
    {
    $kata_pertama_potong = potong_kata($kata_pertama, $kata_pertama_mlai);
    $kata_kedua_potong = potong_kata($kata_kedua, $kata_kedua_mlai);

    echo "$kata_pertama_potong";
    echo "$kata_kedua_potong";

    $kata_pertama_mlai = $kata_pertama_mlai + 1;
    $kata_kedua_mlai = $kata_kedua_mlai + 1;
    }

    echo "“;
    echo “”;
    echo “”;
    echo “”;

    echo “”;
    echo ”  “;
    echo “Untuk menjalankan program lagi klik disini.”;
    echo “”;
    echo “———————————————————–“;
    echo “”;
    echo “*Apabila anda menuliskan lebih dari 1 kata maka
    secara otomatis kata pertamalah yang dipakai dan
    kata setelah itu akan dihapus.
    “;
    echo “”;

    }
    }
    echo “”;
    echo “”;

    ?>

  5. package matdis;

    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class MatDis {

    public static String InputI = JOptionPane.showInputDialog(“Masukkan Input I “);
    public static String InputII = JOptionPane.showInputDialog(“Masukkan Input II “);

    public static void main(String args[]) {

    MatDis coding = new MatDis(); //Construktor
    coding.shuffle(InputI + InputII); //pemanggilan method
    coding.contatination(InputI, InputII); //pemanggilan method

    System.exit(0);
    }

    public void shuffle(String input) {
    List characters = new ArrayList();
    for (char c : input.toCharArray()) {
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() != 0) {
    int tampung = (int) (Math.random() * characters.size());
    output.append(characters.remove(tampung));
    }
    JOptionPane.showMessageDialog(null, “Shuffle :\n”
    + output.toString());
    }

    public void contatination(String input, String input1) {
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Contatination :\n”
    + Buffer);
    JOptionPane.showMessageDialog (null,”By Rizka Putra Mustofa” +
    “\n09.11.3514”);
    System.exit(0);
    }
    }

  6. CODING

    nama : sigit suyono putro
    nim :09.11.3463
    package sigit;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {

    private static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    private static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);
    //Class
    public static void main(String args[]){

    TugasProjek sigit = new TugasProjek(); //Construktor
    sigit.shufflee(varI+varII); //pemanggilan method
    sigit.concet(varI, varII); //pemanggilan method

    System.exit(0); //menjaga input dari NULL
    }

    //metode shuffle
    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int masuk = (int)(Math.random()*characters.size());
    output.append(characters.remove(masuk));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }

    //metode concet
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0); //menjaga input dari NULL
    }
    }

  7. nama : abdul azis
    nim: 09.11.3522

    package Azis;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {

    private static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    private static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);
    //Class
    public static void main(String args[]){

    TugasProjek Azis = new TugasProjek(); //Construktor
    Azis.shufflee(varI+varII); //pemanggilan method
    Azis.concet(varI, varII); //pemanggilan method

    System.exit(0); //menjaga input dari NULL
    }

    //metode shuffle
    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int masuk = (int)(Math.random()*characters.size());
    output.append(characters.remove(masuk));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }

    //metode concet
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0); //menjaga input dari NULL
    }
    }

  8. 09.11.3473

    package Xxx;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {

    private static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    private static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);
    //Class
    public static void main(String args[]){

    TugasProjek xxx = new TugasProjek(); //Construktor
    xxx.shufflee(varI+varII); //pemanggilan method
    xxx.concet(varI, varII); //pemanggilan method

    System.exit(0); //menjaga input dari NULL
    }

    //metode shuffle
    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }

    //metode concet
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0); //menjaga input dari NULL
    }
    }

  9. 1. /*

    2. Shuffle elements of Java ArrayList example

    3. This java example shows how to shuffle elements of Java ArrayList object using

    4. shuffle method of Collections class.

    5. */

    6.

    7. import java.util.ArrayList;

    8. import java.util.Collections;

    9.

    10.public class ShuffleElementsOfArrayListExam
    ple {

    11.

    12. public static void main(String[] args) {

    13.

    14. //create an ArrayList object

    15. ArrayList arrayList = new ArrayList();

    16.

    17. //Add elements to Arraylist

    18. arrayList.add(“A”);

    19. arrayList.add(“B”);

    20. arrayList.add(“C”);

    21. arrayList.add(“D”);

    22. arrayList.add(“E”);

    23.

    24. System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    25.

    26. /*

    27. To shuffle elements of Java ArrayList use,

    28. static void shuffle(List list) method of Collections class.

    29. */

    30.

    31. Collections.shuffle(arrayList);

    32.

    33. System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    34.

    35. }

    36.}

    37.

  10. 1. /*

    2. Shuffle elements of Java ArrayList example

    3. This java example shows how to shuffle elements of Java ArrayList object using

    4. shuffle method of Collections class.

    5. */

    6.

    7. import java.util.ArrayList;

    8. import java.util.Collections;

    9.

    10.public class ShuffleElementsOfArrayListExam
    ple {

    11.

    12. public static void main(String[] args) {

    13.

    14. //create an ArrayList object

    15. ArrayList arrayList = new ArrayList();

    16.

    17. //Add elements to Arraylist

    18. arrayList.add(“A”);

    19. arrayList.add(“B”);

    20. arrayList.add(“C”);

    21. arrayList.add(“D”);

    22. arrayList.add(“E”);

    23.

    24. System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    25.

    26. /*

    27. To shuffle elements of Java ArrayList use,

    28. static void shuffle(List list) method of Collections class.

    29. */

    30.

    31. Collections.shuffle(arrayList);

    32.

    33. System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    34.

    35. }

    36.}

    37.

  11. Nama : Andhika Bayu Dewantara
    Nim : 09.11.3515
    Kelas : S1 – TI – 3M

    package uts;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProject {
    public static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    public static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);

    public static void main(String args[]){

    TugasProjectBayu = new TugasProject(); //Construktor
    Bayu.shufflee(varI+varII); //pemanggilan method
    Bayu.concet(varI, varII); //pemanggilan method

    System.exit(0);
    }

    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);
    System.exit(0);
    }
    }

  12. Nama : Dyah Nitta Juliana
    Nim : 09.11.3497
    Kelas : S1 – TI – 3M

    package uts;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {
    public static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    public static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);

    public static void main(String args[]){

    TugasProjeknita = new TugasProjek(); //Construktor
    nita.shufflee(varI+varII); //pemanggilan method
    nita.concet(varI, varII); //pemanggilan method

    System.exit(0);
    }

    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0);
    }

    }

  13. NIM 09.11.3475
    SALAM WRWB
    TUGAS PA…

    package Billah;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {

    private static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    private static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);
    //Class
    public static void main(String args[]){

    TugasProjek billah = new TugasProjek(); //Construktor
    billah.shufflee(varI+varII); //pemanggilan method
    billah.concet(varI, varII); //pemanggilan method

    System.exit(0); //menjaga input dari NULL
    }

    //metode shuffle
    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }

    //metode concet
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0); //menjaga input dari NULL
    }
    }

  14. package Billah;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {

    private static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    private static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);
    //Class
    public static void main(String args[]){

    TugasProjek billah = new TugasProjek(); //Construktor
    billah.shufflee(varI+varII); //pemanggilan method
    billah.concet(varI, varII); //pemanggilan method

    System.exit(0); //menjaga input dari NULL
    }

    //metode shuffle
    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }

    //metode concet
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0); //menjaga input dari NULL
    }
    }

  15. Nama : Soraya Kusumawati
    Nim : 09.11.3502
    Kelas : S1 – TI – 3M

    package uts;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {
    public static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    public static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);

    public static void main(String args[]){

    TugasProjekraia = new TugasProjek(); //Construktor
    raia.shufflee(varI+varII); //pemanggilan method
    raia.concet(varI, varII); //pemanggilan method

    System.exit(0);
    }

    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0);
    }

    }

  16. Nama : Niken Dyah Wardhani
    Nim : 09.11.3481
    Kelas : S1 – TI – 3M

    package uts;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {
    public static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    public static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);

    public static void main(String args[]){

    TugasProjek niken = new TugasProjek(); //Construktor
    niken.shufflee(varI+varII); //pemanggilan method
    niken.concet(varI, varII); //pemanggilan method

    System.exit(0);
    }

    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0);
    }

    }

  17. Nama : Setyorini Budi Rahayu
    Nim : 09.11.3468
    Kelas : S1 – TI – 3M

    package uts;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JOptionPane;

    public class TugasProjek {
    public static String varI = JOptionPane.showInputDialog(“Masukan Variable I “);
    public static String varII = JOptionPane.showInputDialog(“Masukan Variable II “);

    public static void main(String args[]){

    TugasProjek rini = new TugasProjek(); //Construktor
    rini.shufflee(varI+varII); //pemanggilan method
    rini.concet(varI, varII); //pemanggilan method

    System.exit(0);
    }

    public void shufflee(String input){
    List characters = new ArrayList();
    for (char c:input.toCharArray()){
    characters.add(c);
    }
    StringBuffer output = new StringBuffer(input.length());
    while (characters.size() !=0){
    int kodok = (int)(Math.random()*characters.size());
    output.append(characters.remove(kodok));

    }

    JOptionPane.showMessageDialog(null, “Shuffle \n”
    +”==================\n\n”
    +output.toString()
    +”\n==================”);
    }
    public void concet(String input, String input1){
    String Buffer = input.concat(input1);
    JOptionPane.showMessageDialog(null, “Concet \n”
    +”==================\n\n”
    +Buffer
    +”\n==================”);

    System.exit(0);
    }

    }

  18. //Headers
    #include
    #include
    #include
    #include

    // Random number generator
    int Random(int n)
    {
    return rand() % n ;
    }

    int main(){

    //Seeding random number generator
    std::srand(std::time(0));

    //Numbers to be shuffled
    int Numbers[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

    //Shuffling the numbers
    std::random_shuffle(Numbers, Numbers + 10, Random);

    //Displaying the shuffled numbers
    for(int i=0;i<10;++i)
    std::cout<<Numbers[i]<<" ";

    return 0;
    }

  19. /*
    Nama : Ion bagas Prakoso
    NIM : 09.11.3489
    Kelas : S1-TI-3M

    Program Shuffle
    */

    import java.util.ArrayList;
    import java.util.Collections;

    public class ShuffleElementsOfArrayListExample {

    public static void main(String[] args) {

    ArrayList arrayList = new ArrayList();

    //menambah element array
    arrayList.add(“A”);
    arrayList.add(“B”);
    arrayList.add(“C”);
    arrayList.add(“D”);
    arrayList.add(“E”);

    System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    Collections.shuffle(arrayList);

    System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    }
    }

  20. /* Yuda Yudhistira
    S1 TI 3M
    09.11.3470
    */

    public class Shuffle {

    public static void exch(String[] a, int i, int j) {
    String swap = a[i];
    a[i] = a[j];
    a[j] = swap;
    }

    public static void shuffle(String[] a) {
    int N = a.length;
    for (int i = 0; i < N; i++) {
    int r = i + (int) (Math.random() * (N-i)); // between i and N-1
    exch(a, i, r);
    }
    }

    public static void show(String[] a) {
    for (int i = 0; i < a.length; i++) {
    System.out.println(a[i]);
    }
    }

    public static void main(String[] args) {
    int N = Integer.parseInt(args[0]);
    String[] a = new String[N];

    for (int i = 0; i < N; i++) {
    a[i] = StdIn.readLine();
    }

    shuffle(a);
    show(a);

    System.out.println();

    shuffle(a);
    show(a);

    }
    }

  21. /*
    Nama : Rusdiono
    NIM : 09.11.3496
    Kelas : S1.TI.3M

    Ini adalah program shuffle.
    */

    import java.util.ArrayList;
    import java.util.Collections;

    public class ShuffleElementsOfArrayListExample {

    public static void main(String[] args) {

    //create an ArrayList object
    ArrayList arrayList = new ArrayList();

    //Add elements to Arraylist
    arrayList.add(“A”);
    arrayList.add(“B”);
    arrayList.add(“C”);
    arrayList.add(“D”);
    arrayList.add(“E”);

    System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    Collections.shuffle(arrayList);

    System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    }
    }

    /*
    Keluaran sebelum shuffling : [A, B, C, D, E]
    Keluaran setelah shuffling : [C, A, D, E, B]
    */

  22. /*
    Nama : Singgih Hartanto
    NIM : 09.11.3493
    Kelas : S1.TI.3M

    Ini adalah program shuffle.
    */

    import java.util.ArrayList;
    import java.util.Collections;

    public class ShuffleElementsOfArrayListExample {

    public static void main(String[] args) {

    //create an ArrayList object
    ArrayList arrayList = new ArrayList();

    //Add elements to Arraylist
    arrayList.add(“A”);
    arrayList.add(“B”);
    arrayList.add(“C”);
    arrayList.add(“D”);
    arrayList.add(“E”);

    System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    Collections.shuffle(arrayList);

    System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    }
    }

    /*
    Keluaran sebelum shuffling : [A, B, C, D, E]
    Keluaran setelah shuffling : [C, A, D, E, B]
    */

  23. 1. /*

    2. Shuffle elements of Java ArrayList example

    3. This java example shows how to shuffle elements of Java ArrayList object using

    4. shuffle method of Collections class.

    5. */

    6.

    7. import java.util.ArrayList;

    8. import java.util.Collections;

    9.

    10. public class ShuffleElementsOfArrayListExample {

    11.

    12. public static void main(String[] args) {

    13.

    14. //create an ArrayList object

    15. ArrayList arrayList = new ArrayList();

    16.

    17. //Add elements to Arraylist

    18. arrayList.add(“A”);

    19. arrayList.add(“B”);

    20. arrayList.add(“C”);

    21. arrayList.add(“D”);

    22. arrayList.add(“E”);

    23.

    24. System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    25.

    26. /*

    27. To shuffle elements of Java ArrayList use,

    28. static void shuffle(List list) method of Collections class.

    29. */

    30.

    31. Collections.shuffle(arrayList);

    32.

    33. System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    34.

    35. }

    36. }

    37.

    38. /*

    39. Output would be

    40. Before shuffling, ArrayList contains : [A, B, C, D, E]

    41. After shuffling, ArrayList contains : [C, A, D, E, B]

    42. */

  24. Hasil Program saya berupa kotak dialog JOptionPane. tidak mau keluar.

    Enter first string : sayang
    Enter second string : cinta

    Concatenation : sayangcinta
    Shuffle : scaiynatnag

    Try again?(yes/no/cancel)

  25. /**
    * @author Mukhti Nuryani
    * 09.11.3503
    * S1TI-3M
    */
    import javax.swing.JOptionPane;

    public class Diskret2 {
    public static void main(String[]args){
    int option;

    do{
    String string1 = JOptionPane.showInputDialog(“Enter first string:”);
    String string2 = JOptionPane.showInputDialog(“Enter second string:”);

    String output=””;
    String conca=string1.concat(string2);

    JOptionPane.showMessageDialog(null,”CONCATENATION\n”+conca);

    char[] chars=string1.toCharArray();
    char[] chars2=string2.toCharArray();
    String str2;
    int p1=chars.length;
    int p2=chars2.length;
    int i;
    int j;

    char r[]=new char[p1];
    char m[]=new char[p2];

    if(p1>p2){
    for(i=0;i<p2;i++){

    r[i]=string1.charAt(i);
    m[i]=string2.charAt(i);

    String str=String.valueOf(new char[]{r[i],m[i]});
    output=output+str;
    }
    str2=string1.substring(p2);
    JOptionPane.showMessageDialog(null,"SHUFFLE\n"+output+str2);

    }
    else {
    for(i=0;i<p1;i++){

    r[i]=string1.charAt(i);
    m[i]=string2.charAt(i);

    String str=String.valueOf(new char[]{r[i],m[i]});
    output=output+str;

    }
    str2=string2.substring(p1);
    JOptionPane.showMessageDialog(null,"SHUFFLE\n"+output+str2);
    }
    option=JOptionPane.showConfirmDialog(null,"Try again ? " );
    }while(option==JOptionPane.YES_OPTION);
    }
    }

    Hasil Program

  26. ERVIN NURDIN P
    S1.TI.M
    09.11.3494

    1. /*

    2. Shuffle elements of Java ArrayList example

    3. This java example shows how to shuffle elements of Java ArrayList object using

    4. shuffle method of Collections class.

    5. */

    6.

    7. import java.util.ArrayList;

    8. import java.util.Collections;

    9.

    10.public class ShuffleElementsOfArrayListExample {

    11.

    12. public static void main(String[] args) {

    13.

    14. //create an ArrayList object

    15. ArrayList arrayList = new ArrayList();

    16.

    17. //Add elements to Arraylist

    18. arrayList.add(“Anggur”);

    19. arrayList.add(“Belimbing”);

    20. arrayList.add(“Semangka”);

    21. arrayList.add(“Duku”);

    22. arrayList.add(“Jeruk”);

    23.

    24. System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    25.

    26. /*

    27. To shuffle elements of Java ArrayList use,

    28. static void shuffle(List list) method of Collections class.

    29. */

    30.

    31. Collections.shuffle(arrayList);

    32.

    33. System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    34.

    35. }

    36.}

    37.

    38./*

    39.Output would be

    40.Before shuffling, ArrayList contains : [Anggur, Belimbing, Semangka, Duku, Jeruk]

    41.After shuffling, ArrayList contains : [Semangka, Apel, Duku, Jeruk, Belimbing]

    42.*/

  27. 1. /*

    2. Shuffle elements of Java ArrayList example

    3. This java example shows how to shuffle elements of Java ArrayList object using

    4. shuffle method of Collections class.

    5. */

    6.

    7. import java.util.ArrayList;

    8. import java.util.Collections;

    9.

    10.public class ShuffleElementsOfArrayListExample {

    11.

    12. public static void main(String[] args) {

    13.

    14. //create an ArrayList object

    15. ArrayList arrayList = new ArrayList();

    16.

    17. //Add elements to Arraylist

    18. arrayList.add(“Anggur”);

    19. arrayList.add(“Belimbing”);

    20. arrayList.add(“Semangka”);

    21. arrayList.add(“Duku”);

    22. arrayList.add(“Jeruk”);

    23.

    24. System.out.println(“Before shuffling, ArrayList contains : ” + arrayList);

    25.

    26. /*

    27. To shuffle elements of Java ArrayList use,

    28. static void shuffle(List list) method of Collections class.

    29. */

    30.

    31. Collections.shuffle(arrayList);

    32.

    33. System.out.println(“After shuffling, ArrayList contains : ” + arrayList);

    34.

    35. }

    36.}

    37.

    38./*

    39.Output would be

    40.Before shuffling, ArrayList contains : [Anggur, Belimbing, Semangka, Duku, Jeruk]

    41.After shuffling, ArrayList contains : [Semangka, Apel, Duku, Jeruk, Belimbing]

    42.*/

  28. <?
    /*
    nama : lutfi hanif
    nim : 09.11.3507
    kelas : SI TI 3M
    */
    — mencari shuffle & contatination —

    echo "”;
    echo “”;
    echo “”;
    echo “lutfi hanif – 09.11.3507 – S1 TI 3M”;
    echo “”;
    echo “”;
    echo “”;
    echo ““;
    echo “Lutfi hanif”;
    echo “”;
    echo “09.11.3507”;
    echo “”;
    echo “S1 TI 3M”;
    echo “”;
    echo “
    “;
    echo “#########################”;
    echo “”;

    $proses = $_GET[‘proses’];
    $proses = $_POST[‘submit’];

    if(!isset($proses))
    {
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “masukkan kata pertama”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “masukkan kata Kedua”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo ” “;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    }
    else
    {
    //memotong kata
    function potong ($konten, $kata)
    {
    $TMPNEWSPART = array();
    $TMP = explode(” “, $konten);

    for($i=0; $i < $kata; $i++)
    {
    $TMPNEWSPART[$i] = $TMP[$i];
    }
    $NEWSPART = implode(" ", $TMPNEWSPART);

    return $NEWSPART;
    }

    //memotong huruf
    function potong_kata ($kata, $huruf_ke)
    {
    $potong_kata = substr($kata, $huruf_ke, 1);
    return $potong_kata;
    }

    //mencari jumlah char
    \\function panjang_kata ($kata)
    {
    $panjang_kata = strlen ($kata);
    return $panjang_kata;
    }

    $kata1 = $_POST["kata1"];
    $kata2 = $_POST["kata2"];

    $kata_pertama = potong($kata1, 1);
    $kata_kedua = potong($kata2, 1);

    if ($kata1=='' or $kata2=='')
    {
    echo "Maaf, mungkin ada data yang belum anda masukkan!
    klik disini untuk mengulangi.
    “;
    }
    else
    {

    echo “”;
    echo “”;
    echo “”;
    echo “masukkan kata Pertama”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_pertama“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “masukkan Kata Kedua “;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_kedua“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Contanination”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_pertama$kata_kedua“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Shuffle”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo ““;

    $kata_pertama_mlai = 0;
    $kata_kedua_mlai = 0;

    $panjang_kata_1 = panjang_kata ($kata_pertama);
    $panjang_kata_2 = panjang_kata ($kata_kedua);

    if ( $panjang_kata_1 > $panjang_kata_2 )
    { $jml = $panjang_kata_1; }
    else
    { $jml = $panjang_kata_2; }

    for ( $x = 0; $x < $jml; $x++)
    {
    $kata_pertama_potong = potong_kata($kata_pertama, $kata_pertama_mlai);
    $kata_kedua_potong = potong_kata($kata_kedua,$kata_kedua_mlai);

    echo "$kata_pertama_potong";
    echo "$kata_kedua_potong";

    $kata_pertama_mlai = $kata_pertama_mlai + 1;
    $kata_kedua_mlai = $kata_kedua_mlai + 1;
    }

    echo "“;
    echo “”;
    echo “”;
    echo “”;

    echo “”;
    echo ”  “;
    echo “Untuk menjalankan program lagi klik disini.”;
    echo “”;
    echo “#################”;
    echo “”;
    echo “Terjadi kesalahan dalam menginputkan data..
    maka kata pertama yang dipakai
    “;
    echo “”;

    }
    }
    echo “”;
    echo “”;
    ?>

  29. //Rennanda Pertiwi Boedirahayu..
    //09.11.3501..
    //S1-TI-3M..

    #include
    #include
    #include

    #define MAX [10]

    void menu();
    voidulangi();

    char a[10], b[10];
    intkode, i, j, ii, jj;
    int k, c;

    void main()
    {
    menu();
    }

    void menu()
    {
    cout<<"mencaribentuk shuffle dan concatenation"<<endl;
    cout<<"—————————————-"<<endl;
    cout<<endl;
    cout<>a;
    ii=0;
    for(ii=0; a[ii]; ii++)
    ii=ii++;
    cout<>b;
    jj=0;
    for(jj=0; b[jj]; jj++)
    jj=jj++;

    c=0;
    k=0;

    if(ii<jj)
    {
    k=ii;
    c=jj;
    }
    else
    {
    c=ii;
    k=jj;
    }

    cout<<endl;

    cout<<endl;
    cout<<" bentuk concatenation-nya: "<<endl;
    cout<<" ————————"<<endl;
    cout<<" A & B : "<<a<<b<<endl;
    cout<<" B & A : "<<b<<a<<endl;

    cout<<endl;
    cout<<" bentuk shuffle-nya: "<<endl;
    cout<<" ——————"<<endl;
    cout<<" A shuffle B : ";
    for(i=0; i<c; i++)
    {
    cout<<a[i]<<b[i];
    }

    cout<<endl;
    cout<<" B shuffle A : ";
    for(j=0; j<c; j++)
    {
    cout<<b[j]<<a[j];
    }

    cout<<endl;
    cout<<endl;

    getch();
    }

    //Rennanda Pertiwi Boedirahayu..
    //09.11.3501..
    //S1-TI-3M..

  30. //….Nama : HalimahLuthfiRabbani…………………//
    //….NIM : 09.11.3477…………………………//
    //….Kelas : S1-TI-3M……………………………..//
    //….PROGRAM MENCARI BENTUK SHUFFLE DAN COCATENATION….//

    #include
    #include
    #include

    #define MAX [10]

    void menu();
    voidulangi();

    char a[10], b[10];
    intkode, i, j, ii, jj;
    int k, c;

    void main()
    {
    menu();
    }

    void menu()
    {
    cout<<"MENU UNTUK MENCARI BENTUK SHUFFLE DAN CONCATENATION"<<endl;
    cout<<"—————————————————"<<endl;
    cout<<endl;
    cout<<" SilahkanMasukkanAnggota-anggotaHimpunan " <<endl;
    cout<>a;
    ii=0;
    for(ii=0; a[ii]; ii++)
    ii=ii++;
    cout<>b;
    jj=0;
    for(jj=0; b[jj]; jj++)
    jj=jj++;

    c=0;
    k=0;

    if(ii<jj)
    {
    k=ii;
    c=jj;
    }
    else
    {
    c=ii;
    k=jj;
    }

    cout<<endl;

    cout<<endl;
    cout<<" Bentuk Concatenation-nya: "<<endl;
    cout<<" ————————"<<endl;
    cout<<" A & B : "<<a<<b<<endl;
    cout<<" B & A : "<<b<<a<<endl;

    cout<<endl;
    cout<<" Bentuk Shuffle-nya: "<<endl;
    cout<<" ——————"<<endl;
    cout<<" A shuffle B : ";
    for(i=0; i<c; i++)
    {
    cout<<a[i]<<b[i];
    }

    cout<<endl;
    cout<<" B shuffle A : ";
    for(j=0; j<c; j++)
    {
    cout<<b[j]<<a[j];
    }

    cout<<endl;
    cout<<endl;

    ulangi();

    getch();
    }

    voidulangi()
    {
    charulangi;
    cout<>ulangi;

    clrscr();

    if(ulangi==’y’ || ulangi==’Y’)
    {
    menu();
    }
    else
    {
    cout<<" ..T.E.R.I.M.A…K.A.S.I.H.." <<endl;

    }
    }

    //….Nama : HalimahLuthfiRabbani…………………//
    //….NIM : 09.11.3477…………………………//
    //….Kelas : S1-TI-3M……………………………..//
    //….PROGRAM MENCARI BENTUK SHUFFLE DAN COCATENATION….//

  31. //script java cont’d and shuffle by tangguh guumilar a (09.11.3487) 3m

    import java.io.IOException;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;

    public class main {
    public static void main(String[] args) throws IOException{

    InputStreamReader inReader = new InputStreamReader(System.in);
    BufferedReader input = new BufferedReader(inReader);
    String kata1 = “”;
    String kata2 = “”;

    System.out.println(“input first word ?”);
    kata1 = input.readLine();
    System.out.println(“input second word ?”);
    kata2 = input.readLine();

    System.out.println(“your full word”);
    System.out.println(kata1 + kata2);
    }
    }

    HASILNYA:
    input first word ?
    (masukan kata pertama)
    input second word ?
    (masukan kata kedua)
    first word & second word
    (hasilnya adalah penggabungan ddari kata pertama dan kedua)
    THANK YOU…..

  32. Nama :Abu Sofyan
    NIM: 09.11.3486

    Alur program Shuffel
    Pertama kali program dicompile akan muncul kata
    “program shuffel kata” kemudian.
    1.input kan kata pertama (Rumah)
    2.input kan kata kedua (Makan)
    3.dienter, program akan nmengeskuisi kata tersebut
    4.sehinga outputny akan muncul kata (RMuamkaahn).

    //program shuffel
    #include
    #include
    #include
    #include

    void main() {
    char kata1[50],kata2[50],hasil[50];
    int i,j=0,k=0;

    cout << "PROGRAM SHUFFLE KATA " << endl;
    cout << "=====================" << endl << endl;
    cout << "Masukkan kata pertama : "; gets(kata1);
    cout << "Masukkan kata kedua : " ; gets(kata2);
    for (i=0;i<50;i++){
    if(i%2==0){
    hasil[i]=kata1[j];
    j++;
    }else{
    hasil[i]=kata2[k];
    k++;
    }
    }
    cout << "\n\nHasil Shuffle: " << hasil ;
    getch();
    }

    Alur Program Contatination
    Pertama kali program dicompile, Program akan menampilkan
    kata "program conatination" kemudian:
    1.input kan kata pertama (Rumah)
    2.input kan kata kedua (Makan)
    3.dienter, program akan nmengeskuisi kata tersebut
    4.sehinga outputny akan muncul kata (RumahMakan).

    #include
    #include
    #include

    void main() {
    char kata1[20], kata2[20];
    cout << "PROGRAM CONCATINATION " << endl;
    cout << "=====================" << endl << endl;
    cout << "Masukkan kata pertama : "; gets(kata1);
    cout << "Masukkan kata kedua : " ; gets(kata2);
    strcat(kata1, kata2);
    printf("Hasil concat : %s", kata1);
    getch();
    }

  33. <?
    /*
    bahasa : php
    author : Jarot Achid Alvian | "achidun" | djatoyz alvian
    nim : 09.11.3488
    class : SI TI 3M
    e-mail : djatoyz@gmail.com
    hasil : http://tmcjogja.com/xxx/index.php
    date : 07 November 2010
    time : 18.30 p.m. – 19.00 p.m. (30 minutes)

    — program matematika diskret – mencari shuffle & concatenation —
    */
    echo "”;
    echo “”;
    echo “”;
    echo “Jarot Achid Alvian – 09.11.3488 – S1 TI 3M | Matematika Diskrit”;
    echo “”;
    echo “”;
    echo “”;
    echo ““;
    echo “Jarot Achid Alvian”;
    echo “”;
    echo “09.11.3488”;
    echo “”;
    echo “S1 TI 3M”;
    echo “”;
    echo “Matematika Diskret”;
    echo “”;
    echo “
    “;
    echo “=======================================”;
    echo “”;

    $proses = $_GET[‘proses’];
    $proses = $_POST[‘submit’];

    if(!isset($proses))
    {
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Kata Pertama”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Kata Kedua”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo ” “;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    }
    else
    {
    //memotong kata
    function potong ($konten, $kata)
    {
    $TMPNEWSPART = array();
    $TMP = explode(” “, $konten);

    for($i=0; $i < $kata; $i++)
    {
    $TMPNEWSPART[$i] = $TMP[$i];
    }
    $NEWSPART = implode(" ", $TMPNEWSPART);

    return $NEWSPART;
    }

    //memotong huruf
    function potong_kata ($kata, $huruf_ke)
    {
    $potong_kata = substr($kata, $huruf_ke, 1);
    return $potong_kata;
    }

    //mencari jumlah char
    function panjang_kata ($kata)
    {
    $panjang_kata = strlen ($kata);
    return $panjang_kata;
    }

    $kata1 = $_POST["kata1"];
    $kata2 = $_POST["kata2"];

    $kata_pertama = potong($kata1, 1);
    $kata_kedua = potong($kata2, 1);

    if ($kata1=='' or $kata2=='')
    {
    echo "Maaf, tolong lengkapi pengisian data,
    klik disini untuk mengulangi.
    “;
    }
    else
    {

    echo “”;
    echo “”;
    echo “”;
    echo “Kata Pertama”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_pertama“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Kata Kedua “;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_kedua“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Concatenation “;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo “$kata_pertama$kata_kedua“;
    echo “”;
    echo “”;
    echo “”;
    echo “”;
    echo “Shuffle”;
    echo “”;
    echo “”;
    echo “:”;
    echo “”;
    echo “”;
    echo ““;

    $kata_pertama_mlai = 0;
    $kata_kedua_mlai = 0;

    $panjang_kata_1 = panjang_kata ($kata_pertama);
    $panjang_kata_2 = panjang_kata ($kata_kedua);

    if ( $panjang_kata_1 > $panjang_kata_2 )
    { $jml = $panjang_kata_1; }
    else
    { $jml = $panjang_kata_2; }

    for ( $x = 0; $x < $jml; $x++)
    {
    $kata_pertama_potong = potong_kata($kata_pertama, $kata_pertama_mlai);
    $kata_kedua_potong = potong_kata($kata_kedua, $kata_kedua_mlai);

    echo "$kata_pertama_potong";
    echo "$kata_kedua_potong";

    $kata_pertama_mlai = $kata_pertama_mlai + 1;
    $kata_kedua_mlai = $kata_kedua_mlai + 1;
    }

    echo "“;
    echo “”;
    echo “”;
    echo “”;

    echo “”;
    echo ”  “;
    echo “Untuk menjalankan program lagi klik disini.”;
    echo “”;
    echo “———————————————————–“;
    echo “”;
    echo “*Apabila anda menuliskan lebih dari 1 kata maka
    secara otomatis kata pertamalah yang dipakai dan
    kata setelah itu akan dihapus.
    “;
    echo “”;

    }
    }
    echo “”;
    echo “”;

    ?>

Leave a reply to lutfi hanif / 09.11.3507 Cancel reply