Posts

Showing posts from November, 2013

Konversi Desimal ke Biner Menggunakan Stack - Java

Image
Buatlah New Projrct dengan cara klik file -> new projrct , pilih java application. beri nama project kemudian masukan kode dibawa ini: /*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package biner; import java.util.Scanner; /**  *  * @author Moch. Afif  */ public class Biner {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         System.out.println("Program konversi ke biner dari desimal");         Scanner msk =new Scanner(System.in);         System.out.print("Masukan Nilai Desimal :");         int bil = msk.nextInt();         tumpukan bn=new tumpukan(10);         int n=bil;         while (bil>0){             n=bil%2;                         if (n>0){                 bn.push(1);             }else                 bn.push(0);                         bil=bil/2;    

Pascal - Menghitung Rata-Rata dan Resultan

Image
Referensi dan Tugas sebelum UTS Diketahui: data vx1 sampai vx6 dengan data secara berturut-turut 5,10,2,6,15,25 data vy1 sampai vy6 dengan data secara berturut-turut 2,6,8,12,30,36 Cari Vx dan Vy rata2 dan Resultanya tulis dalam program pascal program data; uses wincrt; var vx,vy,r1,r2:real; begin vx:=(5+10+2+6+15+25)/6; vy:=(2+6+8+12+30+36)/6; r1:=sqr(vx)+sqr(vy); r2:=sqrt(r1); writeln('Vx Rata2       :',vx:0:2); writeln('Vy Rata2       :',vy:0:2); writeln('Resultanya     :',r2:0:2); end.

Java - Balik kata dan Polindrom dengan Stack

Image
Untuk Main Programnya /*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package stack; /**  *  * @author Moch. Afif  */ public class Stack {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         tumpuk st = new tumpuk(5);            st.push("k");            st.baca();           st.push("a");           st.baca();           st.push("k");           st.baca();           st.push("e");           st.baca();           st.push("k");           st.baca();     while(!st.isEmpty()){             String nilai = st.pop(); System.out.print(nilai); System.out.print(" ");         }         System.out.println(" "); } }   Untuk Class Programnya /*  * To change this template, choose Tools | Templates  * and open the temp

Java - Coding Insertion Sort

Image
/*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package tgsinsrtsort; /**  *  * @author Moch. Afif  */ public class Tgsinsrtsort {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         int A[]={89,56,78,32,22,434,78};         int b=A.length;         int i,j,k,l;         int tmp;         System.out.print("Sebelum Insertion Sort : ");         for(i=0;i<b;i++){             System.out.print(A[i]+" ");        }         System.out.println("\n");         for (j=1;j<b;j++){             k=A[j];             i=j-1;             while ((i>-1)&&(A[i]>k)){                 A[i+1]=A[i];                 i--;             }             System.out.print("Proses :");             A[i+1]=k;             for (i=0;i<b;i++)

Java - Coding Selection Sort

Image
 * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package tgsslctsort; /**  *  * @author Moch. Afif  */ public class Tgsslctsort {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         int A[]={90,87,34,56,76,89};        int b=A.length;        int i,j,k,l;        int tmp;        System.out.print("Sebelum Selection Sort : ");         for(i=0;i<b;i++){             System.out.print(A[i]+" ");        }         System.out.print("\n");         for (i=0;i<b;i++){             k=i;             for(j=i+1;j<b;j++){                 if (A[j]<A[k]){                     k=j;                 }                              }             if (k!=i){                 tmp=A[i];                 A[i]=A[k];                 A[k]=tmp;          

Java - Coding Buble Sort

Image
/*  * To change this template, choose Tools | Templates  * and open the template in the editor.  */ package tgsbbsort; /**  *  * @author Moch. Afif  */ public class Tgsbbsort {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         int A[] = {34,65,43,56,87,98,76};         int b=A.length;         int i,j,k,l;         int tmp;         System.out.print("Sebelum Bubble Sort : ");         for(i=0;i<b;i++){             System.out.print(A[i]+" ");         }         System.out.print("\n");         for (i=0; i<=b-1; i++){             for (j=0; j<=b-i-2; j++){                 if (A[j] > A [j + 1]){                     tmp=(A [j]);                     A[j]=A[j + 1];                     A [j + 1]= tmp;                 }                         System.out.println();             Sy

All Of Doc Extra

Image
Kumpulan Materi dan Tugas Judul Link Download Keterangan Tanggal Maba Download Cover 02 Nov '13 Debat Download Makalah dan Pasal 30 Mei '13