tag:blogger.com,1999:blog-15787788334553333122024-03-05T13:33:16.074+07:00 agung imamudinberbagi itu menyenangkanAgung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-1578778833455333312.post-8050660455213451142017-12-23T05:34:00.002+07:002017-12-23T05:34:46.275+07:00SQL Developer View Connection menghilang (Solved)<div dir="ltr" style="text-align: left;" trbidi="on">
Cara menampilkan Connection View yang hilang dari SQL Developer<br />
pilih menu <b>Window</b> > <b>Reset Windows to Factory Settings</b><br />
<br />
Silakan dicoba dan ditunggu sebentar, maka connection view akan muncul kembali.<br />
sekian semoga bermanfaat<b></b><br />
<b><br /></b>
<b>Sql Developer connection view gone (solved)</b><br />
try menu <br />Window > Reset Windows to Factory Settings</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com0tag:blogger.com,1999:blog-1578778833455333312.post-3107720833273879272016-10-01T07:19:00.000+07:002017-12-17T20:30:56.936+07:00Cara menghapus pos dan aktifitas di Facebook yang lalu<div dir="ltr" style="text-align: left;" trbidi="on">Bismillah<br />
Assalamualaikum warohmatulahi wabarokatuh<br />
<br />
Lama tidak pos di blog ini, kali ini saya akan membagikan cara untuk menghapus pos/status di facebook yang telah lalu.<br />
<br />
Langsung saja, berikut langkahnya :<br />
<br />
<ul><li>Gunakan browser google chrome</li>
</ul>Kenapa harus menggunakan google chrome, karena untuk menghapusnya menggunakan extension yang disediakan pada chrome.<br />
<ul style="text-align: left;"><li>Install extension <b>Facebook Post Manager</b></li>
</ul>Anda bisa downloadnya di sini<br />
<b>https://chrome.google.com/webstore/detail/facebook-post-manager/ljfidlkcmdmmibngdfikhffffdmphjae</b><br />
<div><ul style="text-align: left;"><li>Buka profile facebook, kemudian masuk pada activity log dengan mengeklik tombol activity log pada sebelah kanan nama profil </li>
</ul></div><div><ul style="text-align: left;"><li>Jalankan Extension</li>
</ul>Jika sudah berhasil menginstall extension dan buka activity log, klik tombol <b>Facebook Post Manager, </b>maka akan dihadapkan dengan menu Tahun dan bulan dari pos/status yang akan dihapus, setelah menetukan keduanya klik tombol <b>Delete Posts</b>. Dalam proses ini biarkan dulu agak lama, karena extension akan melakukan check pada pos yang akan dihapus, dan jangan mengeklik tombol apapun pada proses ini hingga selesai. Jika sudah selesai, lakukan konfirmasi untuk menghapus, proses ini juga agak cukup lama, jadi mohon bersabar. Extension akan menghapus status aktifitas yang telah dilakukan. </div><div><br />
</div><div>Sekian pos kali ini, semoga bermanfaat.</div><div></div></div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com0tag:blogger.com,1999:blog-1578778833455333312.post-16152771259557464102013-05-16T08:37:00.001+07:002015-10-13T18:29:53.577+07:00Metode Eliminasi Gauss Jordan<div dir="ltr" style="text-align: left;" trbidi="on">Metode Eliminasi Gauss Jordan, Metode ini adalah modifikasi dari metode Metode Eliminasi Gauss. Bedanya pada metode ini nilai akar penyelesaian akan langsung ditemukan. Metode ini tidak hanya menjadikan diagonal bawah menjadi nol namun juga merubah diagonal atas menjadi nol, dengan cara ini hasil dari semua variabel akan langsung tampak. Inilah keunggulan Metode Gauss daripada Metode Gauss Jordan.<br />
<br />
Source code dari metode ini <br />
<a name='more'></a>lebih rumit dari metode Gauss namun jangan pernah menyerah, karena setelah kesulitan ada kemudahaan. Berikut ini source code dan algoritma metode eliminasi gauss jordan yang saya buat.<br />
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm;"><span style="font-family: "Times New Roman","serif";"><br />
</span> <span style="font-family: "Times New Roman","serif";">Algoritma :</span></div><div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm;"></div><ol style="text-align: left;"><li><span style="font-family: 'Times New Roman', serif;">Masukan jumlah ordo matriks;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Masukan semua elemen matriks;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Jika matrik baris 1 kolom 1 == 0:tukar dengan baris lain;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">i=1;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Bagi semua elemen matrik baris satu dengan elemen baris i kolom i;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Simpan nilai baris selanjutnya kolom selanjutnya; (baris[i+1]kolom[i+1])</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Setiap elemen dari baris selanjutnya sampai baris sama dengan ordo dikurangi dengan nilai pada baris [i+1]kolom[i+1] dikali baris[i+1][i];</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Naikan nilai i +1;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Kembali ke langkah 5 sampai i sma dengan ordo</span></li>
<li><span style="font-family: 'Times New Roman', serif;">i=1;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">j=1;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Simpan nilai matrik baris j-1 kolom i dalam variabel temp</span></li>
<li><span style="font-family: 'Times New Roman', serif;">k=i;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Setiap elemen matrik baris j-1 kolom k dikurangi temp dikali elemen matrik baris i kolom k</span></li>
<li><span style="font-family: 'Times New Roman', serif;">k++;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Kembali ke 13, jika k <=jumlah ordo naikan nilai i; kembali ke langkah 11</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Jika i kurang dari or, keluar dari perulangan;</span></li>
<li><span style="font-family: 'Times New Roman', serif;">Cetak semua elemen matriks.</span></li>
</ol><br />
<div class="MsoNormal"></div><div class="MsoNormal"></div><div class="MsoNormal"><br />
<span style="font-family: Courier New, Courier, monospace;">#include <stdio.h></span><br />
<span style="font-family: Courier New, Courier, monospace;">#include <math.h></span><br />
<span style="font-family: Courier New, Courier, monospace;">#define maks 20</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;">main (){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>float x[maks][maks], tempx[maks][maks], temp2[maks], temp;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int i,j,or=3, k=0;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>char a='`';</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts("\t\tMETODE GAUSS JORDAN");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts("\t ax1 + bx2 + cx3 + .... =y");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>do{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan jumlah ordo matrik : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d", &or);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}while(or<2);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0;i<or;i++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("persamaan ke-%d\n", i+1);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=0;j<or;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("nilai %c : ",a+j+1);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%f", &x[i][j]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(j==or-1){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("nilai y : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%f", &x[i][j+1]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>break;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Dalam bentuk augmented matriks\n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0;i<or;i++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("|");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=0;j<or+1;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("%5.1f", x[i][j]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf(" |\n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//tukar</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0;i<3;i++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(x[0][0]==0){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=0;j<or+1;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tempx[i][j]=x[0][j];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=0;j<or+1;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>x[0][j]=x[i+1][j];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=0;j<or+1;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>x[i+1][j]=tempx[i][j];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts("");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//hitung</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0;i<or;i++){ //gauss</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp=x[i][i];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(k=i;k<=or;k++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>x[i][k] /= temp;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=i+1;j<=or;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp2[i] = x[j][i];<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(k=i;k<=or;k++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>x[j][k] -= temp2[i] * x[i][k];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=1;i<or;i++){<span class="Apple-tab-span" style="white-space: pre;"> </span>//gauss jordan<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=1;j<=i;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp2[j] = x[j-1][i];<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(k=i;k<=or;k++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>x[j-1][k] -= temp2[j] * x[i][k];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//cetak</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0;i<or;i++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("|");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(j=0;j<or+1;j++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("%5.1f", x[i][j]);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf(" |\n");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0;i<or;i++){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("nilai x%d = %5.1f \n",i+1, x[i][or] );</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Times, Times New Roman, serif;">Hasilnya keluarannya seperti ini</span><br />
<span style="font-family: Times, Times New Roman, serif;"><br />
</span> <br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://agungimam.blogspot.com/2013/05/metode-eliminasi-gauss-jordan.html" rel="nofollow" target="_blank"><img alt="gauss jordan" border="0" height="295" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMZHWtN6ZV4639d11UhS1u2ftlC0Uyfc8f3I0vkh4PGin722D4HEJF33KgQQvsqXxevpzpmdHKE8u6EXDljGC1q8UHyVWY7puTOCZiWlv7RRbdpIR1YFkX9MxItYoxFvTdNymf8wTrmVI/s400/jordan.png" title="gauss jordan" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><span style="font-family: Times, Times New Roman, serif;">Sekian ilmunya untuk hari ini, semoga bermanfaat. Bagikan keteman-teman Anda, karena berbagi itu menyenangkan.</span><br />
<span style="font-family: Times, Times New Roman, serif;"><i>" "~</i></span></div></div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com10tag:blogger.com,1999:blog-1578778833455333312.post-3072555298171828262013-05-11T18:25:00.000+07:002015-10-13T18:30:40.652+07:00Inherintance dalam Java<div dir="ltr" style="text-align: left;" trbidi="on"><div dir="ltr" style="text-align: left;" trbidi="on"><div class="separator" style="clear: both; text-align: center;"><a href="http://agungimam.blogspot.com/2013/05/inherintance-dalam-java.html" rel="nofollow" target="_blank"><img alt="inheritance" border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxbQqrLgT1f5x87C8IkZYyTGyFcA_ccdGF2xJnlYkSZjlaFjCymuML6fKITgCz-0mbRhadjd9jhy962LYx6F4VCB2yVrcDDs6FBUtzRVqjqkfPCZ1r6vNlYyOvu9EwQ4iP_u3xdPLfzrY/s400/father.jpg" title="inheritance" width="400" /></a></div><br />
<br />
Inheritance merupakan salah satu konsep pemrograman dari Java. Inheritance bisa disebut juga pewarisan. Dalam bahasa Java pewarisan yang dimaksud disi ini adalah suatu <b>class</b> atau <b>base class </b>dapat memiliki <b>subclass </b>atau bisa juga disebut dengan <b>child class. </b>Suatu <b>class</b> dapat <b>mewarisi semua yang ada</b> dalam class kepada <b>subclass. </b>Dengan kata lain subclass merupakan <b>perluasan (extends)</b> dari suatu class.<br />
<a name='more'></a><br />
Saya akan memberikan pendekatan secara analogi. Misal ada <b>class mamalia</b> dan dan juga ada <b>class lumba-lumba</b>. Lumba-lumba termasuk <b>subclass</b> dari class mamalia karena lumba-lumba memiliki atribute atau method sama dengan lumba-lumba hanya saja lumba-lumba dapat berenang. Jadi dapat disimpulkan bahwa class lumba-lumba merupakan perluasan dari class mamalia.<br />
<br />
Berikut adalah penjelasan dengan source code untuk contoh diatas<br />
<b>Class mamalia</b><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">public class mamalia{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public int keljarsusu;</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mamalia (int a){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.keljarsusu = a;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void lahir(){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//kode untuk melahirkan</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Times, Times New Roman, serif;"><b>Class lumba2</b></span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">public class lumba2 <span style="color: blue;">extends</span> mamalia{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public int sirip;</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void renang(){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>//kode untuk berenang</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <br />
<div style="font-family: Times, 'Times New Roman', serif;">Dari source code di atas dapat saya jelaskan bahwa<b> class lumba2</b> merupakan <b>perluasan</b> (<i>extends</i>) dari <b>class mamalia</b>. Subclass lumba2 <b>memiliki atribute, method, dan konstruktor dari class mamalia.</b> Untuk mengakses method dari subclass menggunakan cara seperti biasa.</div><div style="font-family: Times, 'Times New Roman', serif;"><br />
</div><div style="font-family: Times, 'Times New Roman', serif;">Sekian sobat untuk ilmunya hari ini, semoga bermanfaat. Bagikan keteman-teman Anda, karena berbagi itu menyenangkan.</div><div style="font-family: Times, 'Times New Roman', serif;"><br />
</div><div style="font-family: Times, 'Times New Roman', serif;"><i>"Guru kencing berdiri murid kencing berlari"~peribahasa</i></div><br />
</div></div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com4tag:blogger.com,1999:blog-1578778833455333312.post-51250747794027926572013-05-10T18:00:00.000+07:002013-05-13T20:56:45.830+07:00Method-method StringBuffer<div dir="ltr" style="text-align: left;" trbidi="on">
<b>capacity(), </b><b>reverse(), </b><b>serCharAt( , ), </b><b>append(), </b><b>insert( , ), </b><b>delete( , ), dan </b><b>length() </b>merupakan method-method yang ada dalam StringBuffer.<br />
<br />
StringBuffer merupakan class yang digunakan untuk mengubah isi dari suatu string. Alasan digunakan StringBuffer karena string memiliki sifat kekal (<i>immutable string</i>). <i>baca post saya sebelumnya. </i>Dalam StringBuffer juga terdapat beberapa method sepertihalnya String. Berikut akan saya jelaskan beberapa method dalam StringBuffer.<br />
<a name='more'></a><br />
<ul style="text-align: left;">
<li><b>capacity()</b></li>
</ul>
<div>
Method ini digunakan untuk mengetahui kapasitas dari suatu variabel StringBuffer</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "Java";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru = new StringBuffer();</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru1 = new StringBuffer(50);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru : "+baru.capacity());</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru1 : "+baru1.capacity());</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru1 : "+baru2.capacity());</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="capacity()" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgctUWjazZ8ER7IkqsqqApLMz10H0pjoCEPkqCPezj9Kp2RA89d5XPNkvB0tKW7e9faaJs0E9OTGwD86ZZ0cJSUSuFI5_eAlw5oOhgIYUB4x-iIrWpd6WfEhY3G9YB4zMnsBiEhHs67I60/s400/StringBuffer.png" title="capacity()" width="400" /></a></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>reverse()</b></li>
</ul>
<div>
Method ini digunakan untuk membalik isi dari variabel StringBuffer.</div>
</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "StringBuffer";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru awal : "+baru2);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru reverse() : "+baru2.reverse());</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="reverse()" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_T2LcLS5uqpw3Zgkk_MCFE7pvgjEfUmsNfEC7oyjqXdAzA7pRmwiYd2aWjgZaU289ECN4tv69xcwEfdkldkz-jhROKbIMzOROg_obCN362xD8eDNsfro3lxT7VTzWoXlXfE0hKPJdt9k/s400/sb.reverse().png" title="reverse()" width="400" /></a></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>serCharAt( , )</b></li>
</ul>
<div>
Method ini digunakan untuk mengubah karakter pada indeks tertentu.</div>
</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "StringBuffer";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru awal : "+baru2);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>baru2.setCharAt(0,'s'); //mengubah S menjadi s</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>baru2.setCharAt(6,'b'); //mengubah B menjadi b</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru charAt1 : "+baru2);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="setCharAt()" border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg01Fq4ioSzfWV06T83SRZUEeUsIxSv8sJaDOhn8TGrVRpkmMkBGeQ_GFVFI9vMsIO4HCAgRa5lmjVj9G7rzvEpoNVsUSN9SU4T9SANVGVjtm80KQ4bMLr7kTewa4AJSBwcb3oHNProYO0/s400/sb.charat().png" title="setCharAt()" width="400" /></a></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>append()</b></li>
</ul>
<div>
Method ini digunakan untuk menambahkan String pada akhir StringBuffer.</div>
</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "StringBuffer";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("\nbaru (append): "+baru2.append(" method append"));</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="append()" border="0" height="117" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAEc2EfDAjs7BLWjsFcSm582EAfsQ2d9FtXAIJPzyAaHv5V_nnzxNSPnRyvnc3PFVWGGbppp6coTCcSwRGCx3sDG2WQ4rx-zyPd6hGubvaeW1a_xYJViXHyWTdTxyiVkCNX8kjphxbug0/s400/sb.append.png" title="append()" width="400" /></a></div>
<div>
<ul style="text-align: left;">
<li><b>insert( , )</b></li>
</ul>
<div>
Method ini digunakan untuk menyisipkan string pada posisi tertentu.</div>
</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "StringBuffer";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("\nbaru (insert): "+baru2.insert(6, " dan "));</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="insert()" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-qPom82chyphenhyphennGCWstL6yezC7dXClnw7jTFYLIl6gaq-_Vvm628G8I1NlWx0iSUbPwRRrwxgYTbhWqs0HrsPZQ7HpN0u1zwTGZPtZRFaSpo8ZIZg21MSXBVlNcREEFsevJ0Ojn2dIzE74s/s400/sb.insert().png" title="insert()" width="400" /></a></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>delete( , )</b></li>
</ul>
<div>
Method ini digunakan untuk menghapus string pada indeks tertentu.</div>
</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "StringBuffer";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("\nbaru (awal) : "+baru2);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru (delete): "+baru2.delete(4,8));</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="delete()" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvSjoK7CzKWTcQjcZUE-BQUIHfUmitgpvLtqDizyQBuPfGyKyxs_WZPrFbDRnHIQtygt8a-UCDnU6XhrGja9CA-NEnBOKTBxzB94mDcQDQ02tfkRckVAhnhkhH-6qp37kjYbwZr7ecVlc/s400/sb.delete.png" title="delete()" width="400" /></a></div>
<div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>length()</b></li>
</ul>
<div>
Method ini digunakan untuk mengetahui panjang objek.</div>
</div>
<div>
Contoh :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class SB{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "StringBuffer";</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("\nbaru (capacity): "+baru2.capacity());</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru (length) : "+baru2.length());</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Output :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/method-method-stringbuffer.html" rel="nofollow" target="_blank"><img alt="length()" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-86grv4ik9LMnmPbQZxMEXwsspsgKxoq_An4C_-KmS09sktZqHr9ouiLrhkl-YR6KzyKjx2l31-ih1YXF8t_0Lo_wiDUfXbBqOy34lFcNbrbop2_Csl4Or5mlJdkHLSe3gFqJ5IuzpdQ/s400/sb.capacity().png" title="length()" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<i>"Kegagalan dapat dibagi menjadi dua sebab : yakni orang yang berpikir tapi tidak pernah bertindak dan orang yang bertindak tidak pernah berpikir"~WA Nance</i></div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com4tag:blogger.com,1999:blog-1578778833455333312.post-67395796191157311162013-05-09T19:47:00.001+07:002017-12-17T20:29:30.521+07:00Belajar StringBuffer dalam Java<div dir="ltr" style="text-align: left;" trbidi="on">Dalam bahasa pemrograman Java kita mengenal istilah <a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank">String</a>. String merupakan suatu class yang berisi string. Nilai dari String tidak dapat diubah karena String ini memiliki sifat <i><a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank">immutable string</a></i>. Untuk mengatasi sifat dari string diatas java memperkenalkan <b>StringBuffer. </b><br />
<br />
<b>StringBuffer</b> merupakan Class yang bisa digunakan untuk memodifikasi <br />
<a name='more'></a>String. StringBuffer memiliki default kapasitas 16 karakter, tapi biasanya ukuran diatur sendiri dengan mendefinisikan kapasitas pada saat pembuatan. Misalnya adalah sebagai berikut :<br />
<br />
<span style="font-family: "courier new" , "courier" , monospace;">StringBuffer baru = new StringBuffer(50);</span><br />
<br />
Contoh diatas merupakan StringBuffer kosong dengan kapasitas 50 karakter.<br />
<br />
Ada 3 cara untuk mengefinisikan StringBuffer :<br />
<br />
<br />
<ul style="text-align: left;"><li><b>StringBuffer baru = new StringBuffer()</b></li>
</ul><div>secara tidak langsung variabel baru akan menjadi objek StringBuffer dengan ukuran 16 karakter karena defaultnya adalah 16 karakter</div><div><ul style="text-align: left;"><li><b>StringBuffer baru1 = new StringBuffer(50)</b></li>
</ul><div>objek baru1 merupakan StringBuffer dengan panjang karakter 50</div></div><div><ul style="text-align: left;"><li><b>StringBuffer baru2 = new StringBuffer(<i>String</i>)</b></li>
</ul><div>objek baru2 merupakan objek StringBuffer dengan panjang karakter <b><i>String </i><complete id="goog_1695249411"><i>+ </i>16 karakter. </complete></b></div></div><div><b><complete><br />
</complete></b></div><div>Berikut merupakan contoh deklarasi StringBuffer :</div><div><div><span style="font-family: "courier new" , "courier" , monospace;">public class SB{</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata = "Java";</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru = new StringBuffer();</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru1 = new StringBuffer(50);</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>StringBuffer baru2 = new StringBuffer(kata);</span></div><div><span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: "courier new" , "courier" , monospace;"> </span></span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru : "+baru.capacity());</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru1 : "+baru1.capacity());</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("baru1 : "+baru2.capacity());</span></div><div><span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div><div><span style="font-family: "courier new" , "courier" , monospace;">}</span></div></div><div><span style="font-family: "courier new" , "courier" , monospace;"><br />
</span></div><div><span style="font-family: "times" , "times new roman" , serif;">Hasil dari program diatas adalah </span></div><div class="separator" style="clear: both; text-align: center;"><a href="http://agungimam.blogspot.com/2013/05/belajar-stringbuffer-dalam-java.html" rel="nofollow" target="_blank"><img alt="StringBuffer" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgF3WlWz8rLwyeRikvQdXUC042_crCBdYyn4HBsIc4cROALkMATq1t1-nFq_HWJLaffxnZzlg2jsEsUGRH4w6sfUX0OKRtQKbJZSwMEi3RASceu6PZ4aSYQm6KZVPGdGQ22_ODi2pkQ6Fw/s400/StringBuffer.png" title="StringBuffer" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Sekian sobat untuk pengetahuan hari ini.semoga bermanfaat. Mari berbagi karena berbagi itu menyenangkan.</div><div class="separator" style="clear: both; text-align: left;"></div><div class="separator" style="clear: both; text-align: left;"><i>:Jika kamu menciptakan tindakan, kamu menciptakan kebiasaab. Jika kamu menciptakan kebiasaan kamu menciptakan karakter. Jika kamu menciptakan karakter kamu menciptakan nasib"~Andre Maurois</i></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div><span style="font-family: "times" , "times new roman" , serif;"><br />
</span></div></div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com2tag:blogger.com,1999:blog-1578778833455333312.post-51103211635809904402013-05-08T20:38:00.000+07:002013-05-13T20:57:32.058+07:00Konstruktor dan Method dalam String <div dir="ltr" style="text-align: left;" trbidi="on">
<b>equals(), equalsIgnoreCase(), compareTo(), toUpperCase(), toLowerCase(), charAt(), substring(), indexOf(), lastIndexOf(), startsWith(), </b>dan<b> trim()</b> adalah method dan konstruktor yang ada dalam string.<br />
<br />
Sebelum saya jelaskan beberapa konstruktur dan method dalam string diatas, saya akan jelaskan sedikit mengenai string. String adalah suatu class yang memiliki isi string yang tetap. Sekali string dibuat dan di isi, maka isinya tidak dapat dirubah. String memilki banyak konsrtruktor dan method. Langsung saja berikut penjelasan method-method diatas.<br />
<a name='more'></a><br />
<ul style="text-align: left;">
<li><b>equals()</b></li>
</ul>
<div>
Method ini digunakan untuk mengecek isi dari suatu string. Method ini mengembalikan nilai <i>true</i> jika benar dan <i>false</i> jika salah. Method equal ini mengecek isi string secara <i>case sensitive, </i>sehingga jika ada perbedaan kapital ataupun sebaliknya, maka akan mengembalikan nilai <i>false.</i><br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata2="agung";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata3="agung";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata2.equals(kata3));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.equals(kata2));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
}<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="equals()" border="0" height="141" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgzFCjcNHqDWAQ2m81S4DavQi-V8xjL_s6gMMExCRc2KIPOzzQa82TxkNM5gaD7VijOrmCuf1C3IKoX3Vg2BzYnk_FZBv4EWKAwgX7UNGIJvbfbzr84gohdcCtNCh-GItrWRURPAcBeOPw/s400/s.equal.png" title="equals()" width="400" /></a></div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>equalsIgnoreCase()</b></li>
</ul>
<div>
Method ini hampir sama dengan method equals(), hanya saja tidak mengecek secara <i>case sensitive</i>. Jadi method ini tidak mempedulikan adanya perbedaan huruf kapital maupun tidak.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata2="agung";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata3="agung";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata2.equalsIgnoreCase(kata3));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.equalsIgnoreCase(kata2));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="equalsIgnoreCase()" border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBxHN-kSotoA69vkaskmEUkaz2GvbDMXN3RK3RwRfFMKfVFb-eUXwAyd7DYeiqopgq1nTdXNLLp_vtqPQWH0NdEEd-3Maav4PD9e_8t46LWgkawFR1h5edqklQisZP16gohY1GtkcDxbw/s400/s.equalIgnorecase.png" title="equalsIgnoreCase()" width="400" /></a></div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li><b>compareTo()</b></li>
</ul>
<div>
Method ini biasanya digunakan untuk penyortiran. Method ini digunakan untuk membandingka dua string dalam konteks alfabet. Jika string yang target lebih akhir dalam urutan abjad dibanding referansinya, maka method akn mengembalikan negatif, dan sebaliknya. Tapi jika kedua string sama, maka akan mengembalikan 0.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="imam";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata2="agung";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata3="udin";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata2.compareTo(kata3));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.compareTo(kata2));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="compareTo()" border="0" height="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQhk2xrEnovOlR8vQ7Mqsxnxk1409N3eWiuaEQdo9zHiDo26mTaC6n1AF4Yp6uL4TWqPrPIEy9RNSp0ZCmvEjXw0-38AtVCQEVRNeEz6KfStEE5TNsz654BGempXh_1uezq826Ux_C9Tc/s400/s.compareTo.png" title="compareTo()" width="400" /></a></div>
<br />
<ul style="text-align: left;">
<li><b>toUpperCase()</b></li>
</ul>
<div>
Method ini akan mengubah semua isi string yang non kapital akan menjadi kapital. Jika string asal sudah uppercase, maka string yang dikembalikan sama dengan string asal.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="imam";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata2="agung";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata3="udin";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.toUpperCase());</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata2.toUpperCase());</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="toUpperCase()" border="0" height="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQJncIXX6O_Inzofl6FYY0A5pOrAldUKYTkQwMtfpo87QKFOARRjBkPpBhkUQzvdEKyhy49TgnmxfdCk-JN9p5XJf1wglsyRx22oMWjmZI6yLg-iMiLkhICMTY8_G60rJsm8OqvGrEkZk/s400/s.toUpperCase.png" title="toUpperCase()" width="400" /></a></div>
<br /></div>
<div>
<ul style="text-align: left;">
<li><b>toLowerCase()</b></li>
</ul>
<div>
Method toLowerCase merupakan kebalikan dari method toUpperCase(), method ini akan mengembalikan string yang identik dengan string asal namun dalam bentuk non kapital.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG";</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata2="IMAM";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.toLowerCase());</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata2.toLowerCase());</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="toLowerCase()" border="0" height="126" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQd7Auhf7nft3fVLJFKKate1EuOVV7dhazqruH6srNPR_Q_Yy9AuAVK7Jb69SbrQvJj_48OLyZ2-A-YRvS4XnSWldA55FN7c3KKuyx3-UzEK_H628cG5XC5efOxvJ9gdSLVJGixcRJnY4/s400/s.toLowerCase.png" title="toLowerCase()" width="400" /></a></div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li><b>charAt()</b></li>
</ul>
<div>
Method chatAt ini akan mengembalikan karakter pada indeks yang ditunjuk pada string.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.charAt(0));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.charAt(3));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="charAt()" border="0" height="137" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQadDhg5SHcNPZH3NoSn2nBR1UjaAA6X8yVweXt2Ir4xMbPwK3VOdh0QhmZpJj2IgIBvBYcgITHXtI83uStBN-jcEoMCr3bNRxUok_Scz9i9a-JYqQ47_J2UEGWsRBnRQiqzEAvzEdKpc/s400/s.charAt.png" title="charAt()" width="400" /></a></div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li><b>substring()</b></li>
</ul>
<div>
Method ini dibagi menjadi dua, <b>substring(int start) </b>dan<b> substring(int start, int end). </b>Untuk <b>substring(int start) </b>akan mengembalikan sebagaian karakter dari string mulai dari indeks ke <b>start</b> sampai akhir. Sedangkan <b>substring(int start, int end) </b>akan mengembalikan karakter dari indeks ke <b>start</b> sampai <b>end </b>saja.<br />
Contoh :<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG IMAMUDIN";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.substring(5));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.substring(1,10));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="substring()" border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9qfFS7jOJFCZbPtGlYrB9zzg74s_nM-MsympmayLTF4VBZlumXGHU7udMogjbgJtC4LsBrODBTdYJgZMl_dA8XygrNO3ib4HxtAyw4oKgDhtTiNPMz-MlW2_pn3_OyAvpdtf7MU4sBo4/s400/s.substring2.png" title="substring()" width="400" /></a></div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li><b>indexOf()</b></li>
</ul>
<div>
Method ini dibagi menjadi 4 jenis. indexOf(char karakter), indexOf(char, int index), indexOf(String), dan IndexOf(String, int index). Untuk lebih jelas penggunaan tiap method lihat program dibawah.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG IMAMUDIN";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.indexOf("A"));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.indexOf("A",5));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.indexOf("GUNG"));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.indexOf("IMAM",3));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="indexOf()" border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjk-lsWmcVq6-Gzc-ncQyc9G4h9buVFYFMtIFnsYZgGWyBh9tev7dfOPD5XXHaML6SGWwOUS1HdHNjOgwe7HAOS7jue-DgZQmZKsqpWETTOFfdn0fuZQwmraEWG1f33BBYBMa1njty-JxM/s400/s.indexOf.png" title="indexOf()" width="400" /></a></div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li><b>lastIndexOf(char)</b></li>
</ul>
<div>
Method ini hampir sama dengan <b>indexOf()</b> hanya saja pencarian akan dimulai dengan posisi yang terakhir.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG IMAMUDIN";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.lastIndexOf("A"));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.lastIndexOf("A",5));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.lastIndexOf("GUNG"));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.lastIndexOf("IMAM",3));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="lastIndexOf()" border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiF939no-IvR8hw0D6gnvP7pbrbhcag34k2rmgi3I2WH7T4f1wjIJg4F1cAuceeW0d9SRe9ibedGXHWFBD8B8fzzfY7ILIi2dl8Uk-yLjV-_fDcrmwHxjDRPyJKrgLdVrTpQUE9kuFA-hM/s400/s.lastindexOf.png" title="lastIndexOf()" width="400" /></a></div>
<br /></div>
</div>
<div>
<ul style="text-align: left;">
<li><b>startsWith(string)</b></li>
</ul>
<div>
Method digunakan untuk menguji apakah string diawali dengan spesifik karakter tertentu.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata ="AGUNG IMAMUDIN";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.startsWith("AGUNG"));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.startsWith("AGUNG",5));</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="startsWith()" border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxaQIkNRug8onjRJsrt0TNaMdclBpXWmh7JkIr6bpFXa0oP7TnE-K2CnrHYudxh5-QX-FmbOsBT0XH19HfWazMXuBOl6QTYHKdfQiJTa_jAKIVUgL260maZap_dUT_XPEbgCrWYPx6-70/s400/s.startsWith.png" title="startsWith()" width="400" /></a></div>
</div>
</div>
<div>
<ul style="text-align: left;">
<li><b>trim()</b></li>
</ul>
<div>
Method ini digunakan untuk membuang spasi, tab, dan form feeds dari awal sampai akhir yang tidak diperlukan.<br />
Contoh :<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class belajarstring{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String kata =" AGUNG IMAMUDIN ";</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println(kata.trim());</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
Output :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/konstruktor-dan-method-dalam-string.html" rel="nofollow" target="_blank"><img alt="trim()" border="0" height="128" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqypmVt0G8Aipnv4xMF6-1xGGZqH-zUGzxCaQzX-_JY12JQwXybS8T-Eym9ZplqLO3jmPd6sVH1j3-r6w5be_hHynAlZzD0MuU9ehsrXXEVEbZog6yvzvp4Jz2NJEQlxOmfXIJ6jCR5B8/s400/s.trim.png" title="trim()" width="400" /></a></div>
<br />
Sekian penjelasan mengenai method dan konstruktor yang ada dalam String Java. Semoga bermanfaat. bagikan keteman-teman Anda, karena berbagi itu menyenangkan.<br />
<i>"Hidup hanya dapat dimengerti ke belakang tetapi harus dijalani kedepan"~Soren Keikegaard</i></div>
</div>
</div>
</div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com1tag:blogger.com,1999:blog-1578778833455333312.post-10878190588136767332013-05-07T18:21:00.000+07:002013-05-13T20:57:45.582+07:00Overloading konstruktor<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Overloading konstruktor</b> dalam java. Hari ini saya akan membagikan sedit ilmu saya mengenai overloading konstruktor. Sebelum lanjut ke tema <i>post</i> ini saya akan menjelaskan terlebih dahulu mengenai konstruktor. <b>Konstruktor</b> adalah method yang pertama kali dikerjakan oleh suatu class. Sedangkan <br />
<a name='more'></a><b>Overloading konstruktor</b> adalah kejadian pada suatu class yang mempunyai lebih dari satu konstruktor. Maksud dari lebih dari satu kontruktor disini adalah terdapat lebih dari <b>1 kontruktor</b>, dengan tiap konstruktor memiliki <b>parameter yang berbeda</b>.<br />
<br />
Berikut adalah contoh class yang menggunakan konsep overloading konstruktor.<br />
<b>main class :</b><br />
<span style="font-family: Courier New, Courier, monospace;"></span><br />
<span style="font-family: Courier New, Courier, monospace;">public class overload{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>teman baru = new teman("wildan");<span style="color: blue;">//memanggil konstruktor 1</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("pada konstruktor 1 : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>baru.cetak();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>teman lama = new teman("syandu", 100);<span style="color: lime;">//memanggil konstruktor 2</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("pada konstruktor 2 : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>lama.cetak();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>teman cantik = new teman("tania", 100, 10);<span style="color: yellow;">//memanggil konstruktor 3</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("pada konstruktor 3 : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>cantik.cetak();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>} </span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
<b>teman class :</b><br />
<br />
<div style="font-family: 'Courier New', Courier, monospace;">
public class teman{</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public String nama;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public int pacar=0, mantan=0;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public teman(String nm){<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">//konstruktor 1</span></div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>nama = nm;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public teman(String nm, int pac){<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: lime;">//konstruktor 2</span></div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>nama = nm;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>pacar = pac;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public teman(String nm, int pac, int man){<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: yellow;">//konstruktor 1</span></div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>nama = nm;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>pacar = pac;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>mantan=man;</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>public void cetak(){</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("nama : "+nama);</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("pacar : "+pacar);</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("mantan : "+mantan);</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span>}</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<span class="Apple-tab-span" style="white-space: pre;"> </span></div>
<div style="font-family: 'Courier New', Courier, monospace;">
}</div>
<div style="font-family: 'Courier New', Courier, monospace;">
<br /></div>
<span style="font-family: Times, Times New Roman, serif;">Dapat dilihat diatas terdapat 3 buah konstruktor dalam 1 class.</span><br />
<span style="font-family: Times, Times New Roman, serif;">Setelah dijalankan tampilan akan sebagai berikut</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/overloading-konstruktor.html" rel="nofollow" target="_blank"><img alt="overloading konstruktor" border="0" height="210" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkZKXGql9_TjQ-I_PMRUrpStp2aV53-LzsL_hsWMajVBsTLXioi4CYRmFMiiPmpimmNATxBkd629NB4UlwuUAnokpwlSZyHbQFdO1gcdG1teNRLgNkN6e_QX2vc18k7A4QP9gXl8p8oD8/s400/overloadkons.png" title="overloading konstruktor" width="400" /></a></div>
<span style="font-family: Times, Times New Roman, serif;">pada konstruktor 1, tidak terdapat hasil untuk pacar dan mantan, pada konstruktor 2 tidak terdapat hasil untuk mantan, sedangkan pada konstruktor 3 hasinya lengkap.</span><br />
<span style="font-family: Times, Times New Roman, serif;">Sekian untuk ilmunya semoga bermanfaat, bagikan keteman-teman Anda karena berbagi itu menyenangkan.</span><br />
<span style="font-family: Times, Times New Roman, serif;"><br /></span>
<span style="font-family: Times, Times New Roman, serif;"><i>"Meskipun kamu sudah berada dijalur yang benar tidak berarti akan selamat dari perubahan jika kamu hanya duduk"~Will Rogers</i></span></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com4tag:blogger.com,1999:blog-1578778833455333312.post-34446795357789445572013-05-06T19:31:00.000+07:002013-05-13T20:57:58.009+07:00Cara Mengopi Array<div dir="ltr" style="text-align: left;" trbidi="on">
Cara mengopi array. Setelah kemarin saya berbagi mengenai <a href="http://agungimam.blogspot.com/2013/05/mengganti-ukuran-array.html" rel="nofollow" target="_blank">cara mengganti ukuran array</a>, kali ini saya akan berbagi cara untuk mengopi array. Cara untuk mengopi array adalah dengan perintah <span style="font-family: Courier New, Courier, monospace;">System.arraycopy. </span><span style="font-family: Times, Times New Roman, serif;">Perintah ini akan mengopi isi dari array. Dengan perintah ini kita bisa mengopi semua isi dari array maupun hanya sebagian saja. Berikut adalah format penggunaanya :</span><br />
<a name='more'></a><br />
<span style="font-family: Times, Times New Roman, serif;"><br /></span>
<br />
<div style="text-align: center;">
<span style="font-family: Courier New, Courier, monospace;">System.arraycopy(nilai,i,nilaibaru,j,n);</span></div>
<blockquote class="tr_bq">
<span style="font-family: Times, Times New Roman, serif;">nilai = array asal</span></blockquote>
<blockquote class="tr_bq">
nilaibaru = array tujuan</blockquote>
<blockquote class="tr_bq">
i = posisi indeks awal pengopian pada array asal</blockquote>
<blockquote class="tr_bq">
j = posisi indeks awal pengopian pada array tujuan </blockquote>
<blockquote class="tr_bq">
n = jumlah elemen yang dikopi</blockquote>
Berikut contoh program pengkopian array :<br />
<br />
<br />
<span style="font-family: Courier New, Courier, monospace;">public class copyarray{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args []){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int[] array1 = {1,2,3,4,5,6,7};</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int[] array2 = new int[3];</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">System.arraycopy(array1,4,array2,0,3);</span></span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print("Array1 : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int n=0; n<array1.length; n++)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print(array1[n] +" ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br /></span>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println();</span><br />
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print("Array2 : ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int n=0; n<array2.length;n++)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print(array2[n]+" ");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
Hasil dari program diatas adalah<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/cara-mengopi-array.html" rel="nofollow" target="_blank"><img alt="cara mengopi array" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjF4NYaW7a0GIVdsjtJcSerDiQpoMu3CElYmkJvnYDPleu6b8FqB8aRB984dDnmlDY4gA3Aen49pTKeXDlB4LLFrQ8f7alr1otf4xcE6uYRsOAOaGsGdL-f3hAd6EzQPleqRfvkpawDjyw/s400/arraycopy.png" title="cara mengopi array" width="400" /></a></div>
<br />
<br />
Perhatikan hasil array 2, array2 hanya mengopi array1 mulai pada indeks ke-4.<br />
Terimakasih telah berkunjung. Bagikan <i>post </i> ini keteman-teman Anda, karena berbagi itu menyenangkan.<br />
<br />
<i>"Salah satu tempat dimana kesukseksan bisa ditemukan tanpa kerja adalah kamus"~May V. Smith</i></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com1tag:blogger.com,1999:blog-1578778833455333312.post-18371547888331296992013-05-05T18:09:00.001+07:002013-05-13T20:58:10.213+07:00Mengganti Ukuran Array<div dir="ltr" style="text-align: left;" trbidi="on">
Bagaimana cara mengganti ukuran array? Dalam <i>post</i> ini saya akan membahas mengenai bagaimana cara untuk mengganti ukuran array. Sebenarnya ukuran array tidak dapat diganti, namun cara lain yang bisa kita gunakan untuk menjadikan ukurannya lebih besar adalah dengan menggunakan variabel referensi yang sama untuk merujuk array yang baru. Bingung?<br />
<a name='more'></a><br />
<div>
<br />
<div>
Saya akan menggunakan pendekatan melalui contoh, misal ada array : <span style="color: blue; font-family: Courier New, Courier, monospace;">int nilai[] = new int [5]</span>, kemudian saya akan memperbesarnya ukurannya dengan membuat variabel referensi yang sama, seperti ini <span style="color: blue; font-family: Courier New, Courier, monospace;">nilai = new int[10]</span>, dengan seperti ini ukuran array menjadi 10, namun array akan menjadi baru. Untuk lebih jelasnya perhatikan program berikut :<br />
<div>
<br />
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class array2{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int nilai[] = new int[5];</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int i;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0; i<nilai.length;i++){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>nilai[i]=i;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print(nilai[i]+" ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("\nAfter resizing");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>nilai = new int[10];</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(i=0; i<nilai.length;i++){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>nilai[i]=i;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print(nilai[i]+" ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
</div>
</div>
</div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;">Hasil output dari program adalah seperti ini :</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/mengganti-ukuran-array.html" rel="nofollow" target="_blank"><img alt="mengganti ukuran array" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtRqNqfy3mqBmEDYoCpph6-j1xzNmkFsPE_BcAUMCf-7t9sIKxFca4i3KPCwM6NlwRKKW-R2P7cL9W9Nfqow3l_fVzgmI09zI8zxwcVIqGxJlTtuMQ2z39BJ46bZ8Ec-IO9nWwCbs5vq4/s400/array2.png" title="mengganti ukuran array" width="400" /></a></div>
<div>
<span style="font-family: Times, Times New Roman, serif;">ukuran array menjadi lebih besar, namun harus membuat varibel baru yang sama dengan array yang pertama, akibatnya array akan menjadi kosong kembali.</span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;">Sekian untuk ilmunya hari ini, semoga bermanfaat. Bagikan keteman-teman Anda, karena berbagi itu menyenangkan.</span><br />
<span style="font-family: Times, Times New Roman, serif;"><br /></span></div>
<div>
<span style="font-family: Times, Times New Roman, serif;"><i>"Penghargaan merupakan satu faktor utama yang membuat manusia tetap bergerak"~Andrew Fuller</i></span></div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com0tag:blogger.com,1999:blog-1578778833455333312.post-85761553876985599802013-05-04T18:10:00.000+07:002014-03-13T22:43:53.029+07:00Membuat Array pada Java<div dir="ltr" style="text-align: left;" trbidi="on"><div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 36pt;"><span style="font-family: Times, Times New Roman, serif;">Cara membuat <b>array </b>pada Java. Kita mulai dengan pengertian <b>array</b>. <b>Array</b> adalah sekumpulan data yang memiliki tipe yang sama, variabel yang sama dan tiap data dibedakan dengan indeks dalam <b>array</b> tersebut. Indeks dari tiap <b>array</b> dimulai dengan indeks ke-0. Jadi jika suatu <b>array</b> memiliki berisi 5 buah data maka indeks maksimal dari <b>array</b> tersebut adalah 4. Manfaat dari <b>array</b> adalah untuk mengurangi jumlah variabel yang digunakan. <b>Array</b> dapat berbentuk dimensi satu, dua, tiga dan seterusnya tergantung kebutuhan dari pengguna.</span><br />
<a name='more'></a><span style="font-family: Times, Times New Roman, serif;"><o:p></o:p></span></div><div class="MsoNormal" style="margin-bottom: 0.0001pt; text-indent: 36pt;"><span style="font-family: Times, Times New Roman, serif;">Dalam post ini saya akan membagikan sedikit cara untuk mendeklarasikan, membuat, dan mengakses nilai <b>array</b>. Lihat penjelasan dibawah ini.</span> </div></div><span style="line-height: 18px;"><b></b></span><br />
<div><span style="line-height: 18px;"><b><span style="line-height: 18px;"><b><br />
</b></span></b></span></div><span style="line-height: 18px;"><b> Mendeklarasikan array</b></span><br />
<div><span style="line-height: 18px;">sintaks untuk mendeklarasikan array adalah sebagai berikut :</span></div><div><ul style="text-align: left;"><li><i style="line-height: 18px;">tipe array</i><span style="line-height: 18px;">[] <b>nama array; </b><i><b> </b>contoh : <span style="color: blue;">int</span></i><span style="color: blue;">[] buku</span>;</span></li>
<li><i style="line-height: 18px;">tipe array</i><span style="line-height: 18px;">[]</span><span style="line-height: 18px;"><i> nama array =</i><b><i>new tipe array</i>[panjang array]</b></span><span style="line-height: 18px;">; <i>contoh</i> : <span style="color: blue;">float[] luas</span>;</span></li>
</ul><div><span style="line-height: 18px;"><b>Membuat array</b></span></div><div><span style="line-height: 18px;">berikut contoh membuat array</span></div></div><div><blockquote class="tr_bq" style="font-family: 'Courier New', Courier, monospace; line-height: 18px;">int jumlah[] = new int[3];</blockquote><div style="font-family: 'Courier New', Courier, monospace; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>jumlah[0]=70;</div><div style="font-family: 'Courier New', Courier, monospace; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>jumlah[1]=80;</div><div style="font-family: 'Courier New', Courier, monospace; line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>jumlah[2]=65;</div><div style="font-family: 'Courier New', Courier, monospace; line-height: 18px;"><br />
</div><div style="line-height: 18px;"><span style="font-family: Times, Times New Roman, serif;">array diatas merupakan array bertipe<b> int</b> yang bernama <b>jumlah</b> dan panjangnya <b>3</b></span></div><div style="line-height: 18px;"><span style="font-family: Times, Times New Roman, serif;"><b><br />
</b></span></div><div><span style="font-family: Times, Times New Roman, serif;"><span style="line-height: 18px;"><b>Mengakses nilai array</b></span></span></div><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 728x90 bawah post --><br />
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7731065252516422"
data-ad-slot="3294974391"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<div><span style="font-family: Times, Times New Roman, serif;"><span style="line-height: 18px;">berikut adalah mini program tentang mengakses array </span></span></div><div><span style="line-height: 18px;"></span><br />
<blockquote class="tr_bq" style="font-family: 'Courier New', Courier, monospace;"><span style="line-height: 18px;">public class array{</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args []){</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int nilai[] = new int[3];</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>nilai[0]=70;</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>nilai[1]=80;</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>nilai[2]=65;</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(int i=0; i<nilai.length;i++)</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("indeks ke-"+i+" = " +nilai[i]);</span><br />
<span style="line-height: 18px;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="line-height: 18px;">}</span></blockquote><span style="line-height: 18px;"> <span style="font-family: Times, Times New Roman, serif;">tampilan dari program diatas seperti berikut </span><span style="font-family: 'Courier New', Courier, monospace;"> </span><br />
</span><br />
<div style="font-family: 'Courier New', Courier, monospace;"><span style="line-height: 18px;"><br />
</span></div><span style="line-height: 18px;"> </span> <br />
<div class="separator" style="clear: both; text-align: center;"><span style="line-height: 18px;"><a href="http://agungimam.blogspot.com/2013/05/membuat-array-pada-java.html" target="_blank"><img alt="membuat arry" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhGV01oJfzrCJSgztpS7r4pPAOz1BgbKamOeXMFequ4-uPSwQ7sIy9c4Cq2FZwFhG2mfbW778TPyafSzQNDjKdukEAjsQtK_5RyqeAFak2IWvL4p45zcfM-Pqpgt0QpNBDgvUrETNNkDk/s400/array.png" height="122" title="membuat arrat" width="400" /></a></span></div><span style="line-height: 18px;"> </span> <br />
<div class="separator" style="clear: both; font-family: 'Courier New', Courier, monospace; text-align: center;"><span style="line-height: 18px;"><br />
</span></div><span style="line-height: 18px;"> </span> <br />
<div style="font-family: 'Courier New', Courier, monospace;"><span style="line-height: 18px;"><br />
</span></div><span style="line-height: 18px;"> <span style="font-family: Times, Times New Roman, serif;">Sekian ilmunya kali ini, semoga bermanfaat. Bagikan keteman-teman Anda, karena berbagi itu menyenangkan. </span><br />
<span style="font-family: Times, Times New Roman, serif;"><i>"Ketenangan jiwa tidak bisa diraih dengan pelanggaran, tetapi hanya bisa dicapai dengan pengertian"~Albert Einstein</i></span></span></div></div></div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com6tag:blogger.com,1999:blog-1578778833455333312.post-17771147704916572112013-05-03T18:21:00.000+07:002013-05-03T18:21:31.650+07:00Cara membuat Package dalam Java<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="text-indent: 36.0pt;">
<span style="text-indent: 36pt;">Membuat </span><b style="text-indent: 36pt;">package</b><span style="text-indent: 36pt;"> dalam Java. Setelah sebelumnya saya membahas mengenai <a href="http://agungimam.blogspot.com/2013/04/membuat-class-pada-java.html" rel="nofollow">cara
membuat </a></span><i style="text-indent: 36pt;"><a href="http://agungimam.blogspot.com/2013/04/membuat-class-pada-java.html" rel="nofollow">class</a> </i><span style="text-indent: 36pt;">dan <a href="http://agungimam.blogspot.com/2013/04/enkapsulasi-pada-java.html" rel="nofollow">konsep enkapsulasi</a></span><span style="text-indent: 36pt;">, kali ini saya akan
menerangkan sedikit mengenai </span><b style="text-indent: 36pt;">package</b><span style="text-indent: 36pt;">
dan cara membuat </span><b style="text-indent: 36pt;">package </b><span style="text-indent: 36pt;">dalam Java.
Sebelum belajar membuat </span><b style="text-indent: 36pt;">package</b><span style="text-indent: 36pt;">,
terlebih dahulu kita harus mengetahui definisi tentang </span><b style="text-indent: 36pt;">package</b><span style="text-indent: 36pt;">. Apa sih </span><b style="text-indent: 36pt;">package</b><span style="text-indent: 36pt;">
itu? </span><b style="text-indent: 36pt;">Package</b><span style="text-indent: 36pt;"> adalah cara dalam Java
untuk mengatur </span><i style="text-indent: 36pt;">class</i><span style="text-indent: 36pt;"> yang telah
dibuat.</span><o:p></o:p></div>
<div class="MsoNormal" style="text-indent: 36.0pt;">
<b>Package</b> ini sangat berguna sekali saat memiliki <i>class</i> yang banyak. <b>Package</b> membantu mengelompokan <i>class</i>
sesuai yang diinginkan. Satu hal yang menjadi catatan saat membuat <b>package</b> adalah melatakan class yang
memiliki <b>package</b> yang sama dalam
satu direktori / folder, dan nama folder harus sama dengan nama <b>package</b>. Berikut adalah contoh
pembuatan <b>package </b><o:p></o:p></div>
<div class="MsoNormal">
<o:p> 1. Buka notepad kemudian kopikan <i>source code</i> dibawah ini dan simpan dengan nama file keluarga.java</o:p></div>
<div class="MsoNormal">
<o:p></o:p></div>
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">package sensus;<br />public class keluarga {<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>private int jml;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>private String nama;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>public keluarga(int no, String nama){<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>this.jml=no;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>this.nama=nama;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>public int getno(){<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return jml;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getnama(){<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>return nama;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />}</span></blockquote>
<blockquote class="tr_bq">
ini merupakan class yang bernama keluarga dengan<b> package sensus.</b></blockquote>
2. Buka notepad lagi kemudian kopikan <i>source code</i> dibawah ini dan simpan dengan nama file rumah.java<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">package sensus;</span><span style="font-family: Courier New, Courier, monospace;"><br /></span><span style="font-family: Courier New, Courier, monospace;">public class rumah{</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private int norumah;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private String alamat;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private keluarga anggota;</span><span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public rumah( int kode, String nama){</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.norumah = kode;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.alamat = nama;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public keluarga getkeluarga(){</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return anggota;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public int getnorum(){</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return norumah;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getalamat(){</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return alamat;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void setKel(keluarga baru){</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.anggota=baru;</span><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><span style="font-family: Courier New, Courier, monospace;">}</span> </blockquote>
<blockquote class="tr_bq">
ini merupakan class yang bernama rumah dengan<b> package sensus.</b> </blockquote>
3. Atur kedua file diatas ( keluarga dan rumah) dalam satu direktori yang bernama sensus<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/cara-membuat-package-dalam-java.html" rel="nofollow"><img alt="package" border="0" height="167" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOd6zAy_ll1OjqhD9OlHlEZwDP4MC3qkOzLAHL6eJcB9Tvcd6J7bt4k8k-UPARaASuqJSqjFDkJ-2PloGTId6WXkFdb8TTyf_93pv7vOTKmVqLRRDqF5Yi0O0hKPh-6BqrWVCCFHSiDFs/s400/package+explore.png" title="package" width="400" /></a></div>
<br />
4. Buka notepad lagi, kopikan <i>source code</i> dibawah ini dan simpan dengan nama file belajarpackage.java<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">import sensus.*;<br />public class belajarpackage{<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[]){<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>int norum;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>String naKK;<br /><span class="Apple-tab-span" style="white-space: pre;"> </span><span class="Apple-tab-span" style="white-space: pre;"> </span>rumah baru = new rumah(100,"Tuban");<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>baru.setKel(new keluarga(5,"Agung Imamudin"));<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("No rumah : "+baru.getnorum()+"\nAlamat : "+baru.getalamat()+"\nNama KK : "+baru.getkeluarga().getnama()+"\nAnggota kel.: "+baru.getkeluarga().getno());<br /><span class="Apple-tab-span" style="white-space: pre;"> </span>}<br />} </span></blockquote>
<blockquote class="tr_bq">
ini merupakan <i>class</i> utama (<i>main class</i>) yang bernama belajarpackage, gunakan perintah <i><b>import</b></i> untuk memanggil <b>package sensus (</b>lihat pada awal source code).</blockquote>
5. Kemudian jalankan program utama (belajarpackage) maka tampilanya sebagai berikut<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/cara-membuat-package-dalam-java.html" rel="nofollow"><img alt="package" border="0" height="155" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGHIDBTUsAEouafrDABXXKcbSejKVIzKgFE5rUgPY5ZS4CkVJF-GN2PvJmJ-JJQUdBC5CHG9iy-m6XNECHJJAkVtR1XKw_6C0BxW72JDtf1xnqOmI1yKG_swWUwl-jfmyf1W98pQ0YlAI/s400/package.png" title="package" width="400" /></a></div>
Sekian untuk ilmunya kali ini, semoga bermanfaat. Bagikan keteman-teman Anda, karena berbagi itu menyenangkan.<br />
<i>"Sikap kita terhadap kehidupan akan menentukan sikap kehidupan terhadap kita"~Earl Nightingale</i><br />
<br />
<br /></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com8tag:blogger.com,1999:blog-1578778833455333312.post-6562055243809458772013-05-01T19:23:00.000+07:002013-05-03T06:20:34.814+07:00Metode Eliminasi Gauss persamaan linier Simultan<div dir="ltr" style="text-align: left;" trbidi="on">
Metode Eliminasi Gauss adalah salah satu metode numerik yang menerapkan eliminasi untuk mencari nilai variabel dari beberapa persamaan. Metode ini mengubah beberapa persamaan menjadi bentuk matrik. Kemudian dari bentuk matrik ini dilakukan eliminasi sehingga diperoleh satu variabel bebas. Berikut adalah algoritma dan source code metode eliminasi gauss :<br />
Algoritma :<br />
<br />
<ol>
<li><span style="font-family: "Times New Roman","serif";">Masukan
jumlah ordo matriks;</span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"> </span></span></span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"> </span></span></span><span style="font-family: "Times New Roman","serif";">Masukan
semua elemen matriks;</span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;">3.<span style="font: 7.0pt "Times New Roman";">
</span></span></span><span style="font-family: "Times New Roman","serif";"> </span></li>
<li><span style="font-family: "Times New Roman","serif";">Jika
matrik baris 1 kolom 1 == 0:tukar dengan baris lain;</span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">i=1;</span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Bagi
semua elemen matrik baris satu dengan elemen baris i kolom i;</span></li>
<li><span style="font-family: "Times New Roman","serif";">Simpan
nilai baris selanjutnya kolom selanjutnya; (baris[i+1]kolom[i+1])</span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Setiap
elemen dari baris selanjutnya sampai baris sama dengan ordo dikurangi dengan
nilai pada baris [i+1]kolom[i+1] dikali baris[i+1][i];</span></li>
<li><span style="font-family: "Times New Roman","serif";">Naikan
nilai i +1;</span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Kembali
ke langkah 5 sampai i sma dengan ordo</span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"></span></span><span style="font-family: "Times New Roman","serif";">Cetak semua elemen matriks.</span></li>
</ol>
<span style="font-family: "Times New Roman","serif";"> Source code :</span><br />
<span style="font-family: "Times New Roman","serif";"><span style="font-family: "Courier New",Courier,monospace;">#include <stdio.h><br />#include <math.h><br />#define maks 20<br /><br />main (){<br /> float x[maks][maks], tempx[maks][maks], temp2[maks], temp;<br /> int i,j,or=3, k=0;<br /> char a='`';<br /><br /> puts("\t\tMETODE GAUSS ");<br /> puts("\t ax1 + bx2 + cx3 + .... =y");<br /> <br /> do{<br /> printf("Masukan jumlah ordo matrik : ");<br /> scanf("%d", &or);<br /> }while(or<2);<br /><br /> for(i=0;i<or;i++){<br /> printf("persamaan ke-%d\n", i+1);<br /> for(j=0;j<or;j++){<br /> printf("nilai %c : ",a+j+1);<br /> scanf("%f", &x[i][j]);<br /> if(j==or-1){<br /> printf("nilai y : ");<br /> scanf("%f", &x[i][j+1]);<br /> break;<br /> } <br /> }<br /> }<br /> printf("Dalam bentuk augmented matriks\n");<br /> for(i=0;i<or;i++){<br /> printf("|");<br /> for(j=0;j<or+1;j++){<br /> printf("%5.1f", x[i][j]);<br /> }<br /> printf(" |\n");<br /> }<br /> //tukar<br /> for(i=0;i<3;i++){<br /> if(x[0][0]==0){<br /> for(j=0;j<or+1;j++){<br /> tempx[i][j]=x[0][j];<br /> }<br /> for(j=0;j<or+1;j++){<br /> x[0][j]=x[i+1][j];<br /> }<br /> for(j=0;j<or+1;j++){<br /> x[i+1][j]=tempx[i][j];<br /> } <br /> }<br /> }<br /> //hitung<br /> for(i=0;i<or;i++){<br /> temp=x[i][i];<br /> for(k=i;k<=or;k++){<br /> x[i][k] /= temp;<br /> } <br /> for(j=i+1;j<=or;j++){<br /> temp2[i] = x[j][i]; <br /> for(k=i;k<=or;k++){<br /> x[j][k] -= temp2[i] * x[i][k];<br /> }<br /> } <br /> }<br /> puts("");<br /> //cetak<br /> printf("Setelah eliminasi : \n");<br /> for(i=0;i<or;i++){<br /> printf("|");<br /> for(j=0;j<or+1;j++){<br /> printf("%5.1f", x[i][j]);<br /> }<br /> printf(" |\n");<br /> }<br /> puts("");<br />}</span></span><br />
<span style="font-family: "Times New Roman","serif";"><span style="font-family: "Courier New",Courier,monospace;"><span style="font-family: Times, "Times New Roman", serif;">untuk contoh mari kita cari akar dari persamaan di bawah ini :</span></span></span><br />
x1 + x2 + x3 = 6<br />
x1 + 2x2 -x3 = 2<br />
2x1 + x2 + 2x3 = 10<br />
Maka outputnya akan seperti berikut :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/05/metode-eliminasi-gauss-persamaan-linier.html" rel="nofollow"><img alt="metode gauss" border="0" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIsvIqt3HD_c_gIZ7bszD3vr_jwz8bKDSXocIh9DUiH1bsZ4DoJ9iGdiV1gNilqbCnujJBVeaK1wtasDES6wSju7xyMh-83U8gL1WyHxZ-n0BYl5sbjC8hxG0jVg5D85-WxpxR-KLIGxw/s1600/gauss.png" title="Metode gauss" width="400" /></a></div>
Sekian untuk ilmu hari ini. Bagikan ke orang-orang yang Anda kenal karena berbagi itu menyenangkan.<br />
<i>"</i><i>Penghargaan merupakan satu pendorong utama yang membuat manusia tetap bergerak"~Andrew Fuller</i><br />
<br /></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com7tag:blogger.com,1999:blog-1578778833455333312.post-40838643485730790412013-04-30T20:37:00.002+07:002013-05-04T14:43:25.711+07:00Pengertian, Algoritma dan Souce Code Tahun Kabisat <div dir="ltr" style="text-align: left;" trbidi="on">
Tahun kabisat adalah tahun dengan jumlah hari pada satu tahun adalah 366 hari lebih satu hari dari tahun biasanya atau 365. Tahun ini terjasi setiap 4 tahun sekali. Alasan kenapa setiap 4 tahun ada tahun kabisat adalah karena sebenarnya dalam 1 tahun jumlah hari tidak genap 365 hari, namun 365 hari 5 jam 48 menit 45, 1814 detik(wikipedia). Oleh karena itu agar setiap tahun tidak kekurangan beberapa jam ini, setiap 4 tahun jumlah hari akan ditambah dengan 1 hari hari. Sebagai tambahan 1 hari tersebut, dimasukan hari pada tanggal 29 Februari. Tanggal 29 Februari hanya akan ada setiap empat tahun sekali. Bagaimana cara menentukan tahun kabisat?<br />
Caranya adalah membagi tahun dengan 400, jika habis dibagi dengan 400, maka tahu itu jelas kabisat, atau jika tahun itu tidak habis dibagi dengan 400 tapi habis dibagi dengan 100 dan habis dibagi 4, juga termasuk tahun kabisat. Berikut adalah Algoritma dan Source Code tahun kabisat :<br />
<div>
Algorima :</div>
<div>
<ol style="text-align: left;">
<li>Masukan tahun;</li>
<li>Apakah tahun dimodulus 400 ==0 atau dimodulus 400 != 0 dan dimodulus 100 !=0 dan dimodulus 4 ==0?</li>
<li>jika ya: maka tahun sama dangan tahun kabisat</li>
<li>jika tidak: tahun bukan tahun kabisat</li>
</ol>
<div>
Source Code :</div>
</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">import java.util.Scanner;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">public class kabisat {</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> public static void main (String [] args){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> int tahun;</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Scanner input = new Scanner(System.in);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print("Masukan tahun : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>tahun = input.nextInt();</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span> </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> if ((tahun % 400 == 0) | (tahun % 400 != 0 & tahun % 100 != 0 & tahun % 4 ==0))</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> System.out.println(tahun+" adalah tahun kabisat");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> else</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> System.err.println(tahun+" bukan tahun kabisat");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"> }</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
<span style="font-family: Times, Times New Roman, serif;">tampilannya seperti berikut :</span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/pengertian-algoritma-dan-souce-code.html" rel="nofollow"><img alt="tahun kabisat" border="0" height="146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU_RdrQuFaDb1DbrjlHaxAb4QFmhhPBQpcqsnlXzRl6H7dkZXPFhHrf1kR2dcjvsyc7i2udZclKVnqS-vA1vkkdaJFXRQXVkRCjJiEh-xKq97pLLu_EtnbGU3huTeqjw_0LEGBOvmYKVQ/s400/kabisat.png" title="tahun kabisat" width="400" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
Sekian ilmu hari ini, semoga bermanfaat.</div>
<div class="separator" style="clear: both; text-align: left;">
<i>"Target adalah mimpi yang memiliki batas waktu"~Paul Hanna</i></div>
<div>
<span style="font-family: Times, Times New Roman, serif;"><br /></span></div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com0tag:blogger.com,1999:blog-1578778833455333312.post-55122466220736178642013-04-29T17:57:00.000+07:002014-03-13T22:45:54.520+07:00Enkapsulasi pada Java<div dir="ltr" style="text-align: left;" trbidi="on">Kali ini kita belajar Enkapsulasi. Enkapsulasi adalah pembungkus. Maksud dari pembungkus adalah suatu cara untuk meyembunyikan implementasi detil dari class untuk mencegah akses yang ilegal. Ada dua hal yang mendasar dari enkapsulasi yaitu <i>information hiding </i>dan <i>interface to access data. </i>Berikut sedikit penjesalan dari hal diatas. <i>Information hiding</i> adalah menyembunyikan informasi dari suatu class agar tidak bisa diakses dari luar class, caranya hanya dengan memberikan modifier <i>private </i>pada varibel yang ingin kita <i>hiding</i>. Selanjutnya mengenai<i> interface to acces data, </i>ialah cara kita untuk mengubah nilai pada suatu variabel yang telah dilakukan <i>information hiding. </i>Cara yang biasa dilakukan adalah melalui <i>method,</i> lewat <i>method </i>ini kita bisa merubah nilai suatu variabel yang telah mengalami<i> information hiding. </i>Berikut adalah contoh program dengan konsep enkapsulasi.<br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 728x90 bawah post --><br />
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7731065252516422"
data-ad-slot="3294974391"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
Listing program :<br />
<b>class</b><br />
<span style="font-family: Courier New, Courier, monospace;">public class Mahasiswa{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private int nrp;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>private String nama;<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public Mahasiswa (int nrp, String nama){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.nrp = nrp;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>this.nama = nama;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public int getNrp(){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return nrp;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public String getNama(){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return nama;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">} </span><br />
<span style="font-family: Times, Times New Roman, serif;"><b>main class</b></span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">public class coba{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args []){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Mahasiswa anak = new Mahasiswa(2103121043, "Agung Imamudin");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("NRP : "+anak.getNrp()+"\nNama : "+anak.getNama());</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><br />
</span> <span style="font-family: Times, Times New Roman, serif;">maka <i>output-</i>nya seperti berikut :</span><br />
<div class="separator" style="clear: both; text-align: center;"><span style="font-family: Times, Times New Roman, serif;"><a href="http://agungimam.blogspot.com/2013/04/enkapsulasi-pada-java.html" rel="nofollow"><img alt="enkapsulasi" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi87Yw478xrvF16YjdlP_-_3NcrVmBDf4csewhBK-IENDoVQxkewrYY9W_uh7TWmAvibh6oQ9wRgm5vNE_jC6x8WF56EwtyzfFcBRh2qTVdwkBHj4gG_m-kPwscC2nvkhr4m20SvM4Ve6o/s400/enkapsulasi.png" height="101" title="enkapsulasi" width="400" /></a></span></div><div class="separator" style="clear: both; text-align: center;"><span style="font-family: Times, Times New Roman, serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: left;"><span style="font-family: Times, Times New Roman, serif;">Semoga bermanfaat. Bagikan keteman-teman Anda, karena berbagi itu menyenangkan.<br />
<i>"Jika seorang menghendaki perubahan maka dirinya harus berubah sebelum perubahan terjaadi"~Gita Bellin</i></span></div><br />
</div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com1tag:blogger.com,1999:blog-1578778833455333312.post-38913367455824989442013-04-28T19:32:00.000+07:002014-03-13T22:46:40.351+07:00Membuat Class pada Java<div dir="ltr" style="text-align: left;" trbidi="on">Belajar membuat Class pada Java. Sebelum membuat Class terlebih dahulu kita harus mengenal Objek, Class, Method, dan Atribute. <b>Objek</b> adalalah orang, benda, dan sebagainya yang memiliki atribute, dapat melakukan method dan tergolong dalam class tertentu. <b>Class </b>dapat dapat diartikan sebagai jenis untuk mengelompokan objek-objek yang ada. <b>Atribute </b>adalah sesuatu yang dimiliki oleh suatu objek. <b>Method </b>adalah sesuatu yang dapat dilakukan oleh suatu objek. Untuk lebih jelasnya saya akan menggunakan pendekatan analogi. Misal Adi (nama orang), dia adalah <b>objek</b>. Adi termasuk <b>class</b> manusia. Adi memiliki <b>atribute</b> tangan, kaki, mulut, dan sebagainya. Adi memiliki <b>method</b> tertawa, menangis, berjalan, berlari, makan, dan sebagainya. Method juga dapat disebut juga behavior atau hal yang dapat objek lakukan.<br />
Berikut adalah cara/format untuk membuat class :<br />
<a name='more'></a><br />
<span style="font-family: Courier New, Courier, monospace;"><modifier> class <nama class> {</span><br />
<blockquote class="tr_bq"><span style="font-family: Courier New, Courier, monospace;"><inisialisasi atribute></span></blockquote><blockquote class="tr_bq"><span style="font-family: Courier New, Courier, monospace;"><inisialisasi konstruktor></span></blockquote><blockquote class="tr_bq"><span style="font-family: Courier New, Courier, monospace;"><inisialisasi method> </span></blockquote><span style="font-family: Courier New, Courier, monospace;">}</span><br />
<span style="font-family: Times, Times New Roman, serif;">Contoh : </span><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 728x90 bawah post --><br />
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7731065252516422"
data-ad-slot="3294974391"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="font-family: Courier New, Courier, monospace;">public class orang{ <span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: red;">//class orang</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int mulut; <span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">//mulut = atribut</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public orang(int i){<span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: purple;">//konstruktor</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>mulut = i;</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public void cekkerja(){ <span style="color: lime;">//method</span></span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if(mulut>1)</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Berbicara");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>else</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Diam");</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<br />
<span style="font-family: Times, Times New Roman, serif;">contoh fungsi utama dari class diatas adalah :</span><br />
<br />
<span style="font-family: Courier New, Courier, monospace;">class coba{</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main (String args[]){</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>orang Adi = new orang(2);</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>Adi.cekkerja();</span><br />
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span><br />
<span style="font-family: Courier New, Courier, monospace;">}</span><br />
<div style="font-family: Times, 'Times New Roman', serif;">maka setelah dijankan outputnya seperti berikut : </div><div class="separator" style="clear: both; text-align: center;"><a href="http://agungimam.blogspot.com/2013/04/membuat-class-pada-java.html" rel="nofollow"><img alt="belajar membuat class" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRmjQ2_VMpJD8hHqLUpFq57Nt6SUPpvVqHwtidGXK0k4t3Q-BTtQwGy7sMpFunQ6QffSXw3yT11qNzX1h6fne1mgrC3OhdEdLhSyEi61QzbHAQco7xBEosDD1wzsOshpL0qb0H2n4kPLU/s400/class.png" height="117" title="belajar membuat class" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Sekian ilmu hari ini semoga bermanfaat, bagikan ke teman-teman Anda. karena berbagi itu menyenangkan. Jika kurang jelas bida ditanyakan.</div><div class="separator" style="clear: both; text-align: left;"><i>"Semakin banyak kita membutuhkan pujian orang lain, semakin sering pula kita takut akan celaan"~Hans Selye.</i></div><div style="font-family: Times, 'Times New Roman', serif;"><br />
</div><div style="font-family: Times, 'Times New Roman', serif;"><br />
</div><br />
</div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com2tag:blogger.com,1999:blog-1578778833455333312.post-40356945974344571542013-04-27T19:23:00.003+07:002013-04-27T19:23:33.537+07:00Algoritma Source Code deret Fibonacci<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/algoritma-source-code-deret-fibonacci.html" rel="nofollow" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="fibonacci" border="0" height="247" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcgKYqfDZQAvO4y1z4TUBzh5i-HPvzzdhL4r8oqiJNyeAvaVnp5mjD7iE_R6cS6P2z3f1fhxLg1L6jphGb02UOcfCftx5VQu26JbqYI0DpmsbLfuuGIwP-kTRiYrEd6epTzwvpEnJaKa4/s1600/fibonacci2.png" title="fibonacci" width="400" /></a></div>
Deret fibonacci. Apakah deret fibonacci itu? Deret Fibonacci adalah deret yang dimulai dari angka 0 dan 1, kemudian deret selanjutnya merupakan penjulahan 2 deret sebelumnya. Sejarah deret fibonacci berawal dari Gopala dan Hemachandra, matematikawan dari India pada tahun 1150. Namun di eropa deret ini diperkenalkan oleh Leonardo da Pisa sekitas pada tahun 1200. Dan perlu diketahui deret ini sangat unik. Setiap perbandingan dari deret ke n dan deret n-1 selalu mendekati nilai 1.6, misal deret ke-7 dan deret ke 6, 8 dibanding dengan 5 maka hasilnya adalah 1.6. Untuk algoritma dan source code deret fobonacci seperti berikut :<br />
<a name='more'></a><br />
Algoritma :<br />
<ol>
<li>Inisialisasi variabel array, isi indeks ke-0, 0 dan ke-1, 1;</li>
<li>Masukan jumlah bilangan yang akan dicetak;</li>
<li>Apakah bilangan yang dicetak (i) sudah lebih besar dari yang diinginkan? tidak : keluar perulangan</li>
<li>Cetak array indek ke-i;</li>
<li>Array[i+2] = array[i] +array[i+1];</li>
<li>Kembali ke langkah 3;</li>
<li>Exit.</li>
</ol>
<br />
Source code :<br />
<br />
<span style="font-family: "Courier New",Courier,monospace;">import java.util.Scanner;<br />public class lat2fibo{<br /> public static void main (String args[]){<br /> int[] bil=new int[100];<br /> bil[0]=0;<br /> bil[1]=1; <br /> int deret;<br /> <br /> Scanner input = new Scanner (System.in);<br /> System.out.print("Masukan jumlah deret : ");<br /> String data = input.nextLine();<br /> deret = Integer.parseInt(data);<br /> <br /> for(int i=0;i<deret;i++){<br /> System.out.print(bil[i]+" ");<br /> bil[i+2]=bil[i]+bil[i+1];<br /> }<br /> }<br />} </span><br />
<br />
Output : <br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/algoritma-source-code-deret-fibonacci.html" rel="nofollow"><img alt="fibonacci" border="0" height="89" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKsU1obQLx_6A3yBfAbvaB2YPDuHqBx2aA7jBLXOS7Jyb11dTafOpHXcrYVqiYU5wVV4KoxMfvHOspoM_02PAb4qbFb-vxPboObI-60g8F9vQyxt2eWtov1TVsGuak48pHMOqcTOT1V58/s1600/fibonacci.png" title="fibonacci" width="320" /></a></div>
<br />
referensi : id.wikipedia.org<br />
sekilas motivasi : "<span style="font-family: "Times New Roman","serif";"><i>Kebanggaan
kita yang terbesar bukanlah kita tidak pernah jatuh, melainkan bangkit kembali
ketika jatuh</i>."<i>~Confucius</i></span></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com2tag:blogger.com,1999:blog-1578778833455333312.post-12422158493968811442013-04-27T15:39:00.001+07:002013-04-27T15:40:23.886+07:00Algoritma, Source Code Metode Secant<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="separator" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/algoritma-source-code-metode-secant.html" rel="nofollow"><img alt="Metode Secant" border="0" height="195" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx5v3EVx4PD7PAYCPweIKA0SiKpLelIvM0NkHmUS04eR-NzXN3P8jms4W_0v_CkvBD4bTpCRLb69Kh3sYNWny-5OGGr607LTc5n2GnnaDqUzn6EvYeFfEMZ1sfpkmfcTwcscdDH9WkiN8/s400/metode+secant.png" title="Metode Secant" width="400" /></a></div>
<br />
Metode Secant merupakan perbaikan dari <a href="http://agungimam.blogspot.com/2013/04/metode-newton-raphson-algoritma-dan.html" rel="nofollow">Metode Newton Raphson</a>. Perbedaan dari Metode Secant ini adalah rumus untuk mencari nilai x selanjutnya dan juga pada Metode Secant membutuhkan inputan 2 nilai x untuk memulai iterasi. Perbedaan lainya sekaligus keunggulan Metode Secant ini adalah tidak perlu mengetahui turunan dari fungsi yang telah kita inisialisasi, berbeda dengan Metode Newton Raphson yang harus menginisialisasi 2 buah fungsi, yaitu fungsi f(x) dan f'(x) (turunan fungsi f(x)).<br />
Berikut algoritma dari Metode Secant :<br />
<a name='more'></a><br />
<br />
<ol style="text-align: left;">
<li>inisialisasi fungsi x (f(x));</li>
<li>inisialisai array x[ ], fx[ ],e, abso[ ] //e merupakan nilai error, abso merupakan absolut dari fx</li>
<li>inisialisasi k,i,n, dan temp = 0;</li>
<li>masukan batas awal, batas akhir, nilai error dan jumlah iterasi</li>
<li>apakah i kurang dari n ?(n=jumlah iterasi maksimum)</li>
<li>ya :</li>
<li>fx[indeks i]=fungsix(x[indeks i]);</li>
<li>fx[indeks i+1] =fungsi(x[indeks i+1]);</li>
<li>x[indeks 1+2]= x[indeksi+1] - fx[indeks i+1] * (x[indeks i+1] - x[indeks i]) / (fx[indeks i+1] - fx[indeks i]);</li>
<li>fx[indeks i+] = fungsi(x[indeks i+2]);</li>
<li>abso[indeks i] = fx[indeks i+2];</li>
<li>jika fx[indeks i+2]<0 : abso[indeks i] dikali -1 //menjadi positif</li>
<li>cetak nilai x[indeks i+2], fx[indeks i+2], dan abso[indeks i];</li>
<li>jika abso[indeks i]<0 :keluar perulangan;</li>
<li>increment nilai i;</li>
<li>kembali ke langkah 5.</li>
</ol>
<div>
<i>Source Code-</i>nya seperti berikut :</div>
<div>
<br /></div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#include <stdio.h></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#include <math.h></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#define max 100</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">double fungsix(double);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">main(){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double x[max]={0.5}, fx[max], e=0.0001,abso[max]; </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int i =0, n=0,j=0,k=0, temp=0;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts("\t\t >>>METODE SECANT<<<");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts("\t\t f(x)=x *x - (x+1)^exp(-x)");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan nilai awal : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%lf", &x[0]); </span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan nilai akhir : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%lf", &x[1]);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan nilai error : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%lf", &e);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan jumlah iterasi : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d", &n);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts(" no x\t fx absolut fx");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>while(i<=(n-1)){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx[i] = fungsix(x[i]);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx[i+1] = fungsix(x[i+1]);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>x[i+2] = x[i+1] - fx[i+1] * (x[i+1] - x[i]) / (fx[i+1] - fx[i]);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx[i+2] = fungsix(x[i+2]);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>abso[i] = fx[i+2];</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (fx[i+2] < 0 )</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>abso[i] *=-1;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("%3d %9lf %15.9lf %9lf\n",i+1,x[i+2], fx[i+2], abso[i]);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if ( abso[i] < e )</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>break;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>i++;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}<span class="Apple-tab-span" style="white-space: pre;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">double fungsix (double a){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double hasil;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: blue;">hasil = a*a - (a+1)*(exp(-a));</span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return hasil;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
keterangan : teks dengan warna biru adalha fungsi yang saya gunakan, sobat bisa menggantinya dengan fungsi yang lain.</div>
<div>
terimakasih sobat yang telah berkunjung, jangan lupa untuk di bagikan. Berbag itu menyenangkan.</div>
<div>
sekilas motivasi untuk hari ini :</div>
<div>
"<i>Keberuntungan adalah peristiwa saat persiapan bertemu dengan peluang"~L. Seneca</i></div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com1tag:blogger.com,1999:blog-1578778833455333312.post-77358680071614493892013-04-27T15:39:00.000+07:002013-04-27T15:39:16.899+07:00Perulangan Java for, while dan do while<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;"><img alt="perulangan java" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWsliATt-5CHjfDJ30ewnreE8nLDhfRpJFxv90SLfkU6tUvWXRzkfKMg2_hwCSZojGCDnDWb6C0VXaFhdfWlRmzSUY465_uw0dVrLsMx1Usd4GIUOQXtIkn8Uxt14-KJbGPDXjg4kyJlE/s1600/logo_java3.png" title="perulangan java" /></a>Setelah kemarin membahas mengenai percabangan dalam Java, kali ini saya akan memberikan penjelasn sedikit mengenai perulangan dalam java. Sama halnya dengan bahasa C, perulangan di java dibagi menjadi 3, for, while dan do while. Setiap perulangan memiliki penggunaannya masing-masing. Berikut penjelasan mengenai tiap-tiap perulagan.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<ul style="text-align: left;">
<li><b>for</b> : perulangan for digunakan saat kita mengetahui berapa banyak perulangan yang akan kita lakukan. Sintaks peulangan for seperti berikut :<a name='more'></a></li>
</ul>
<blockquote class="tr_bq">
Contoh : </blockquote>
<div class="separator" style="clear: both; text-align: center;">
</div>
<blockquote class="tr_bq" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow"><img alt="perulangan for" border="0" height="118" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4nc4BpAL4rLyRpLF2R3M55UHl2_iRrYvpX6y80kD5SqKnAhR1dwbRd9XOb8YXl3Axg_mvJdCGfeE1pLsl9SP7LFT0aNces8b48CcXJy-IqCqGe9hBh_kJsPdb7dNGWk_JsEqY9dzjse0/s320/for.png" title="perulangan for" width="320" /></a></blockquote>
<br />
<br />
<blockquote class="tr_bq">
<span style="font-family: Courier New, Courier, monospace;">a</span> merupakan variabel yang dirubah, <span style="font-family: Courier New, Courier, monospace;">a<5</span> merupakan kondisi, dan <span style="font-family: Courier New, Courier, monospace;">a++</span> adalah pengubah </blockquote>
<br />
<blockquote class="tr_bq">
Output : </blockquote>
<blockquote class="tr_bq">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow"><img alt="perulangan for" border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfVZQPi2FF8B2tB_v2Zc5mY5AE2qv41NJGWH_E64emSxujmu4jZBMebOsLpWzb6cdkYx8i2-hE37yo9RVk27ZQYFY1Wl1aMSmGXHhmC5QamxlpxlyIE1ZnX70lUhAAOYcfUOPnlf8jedM/s320/for+print.png" title="perulangan for" width="320" /></a> </blockquote>
<blockquote class="tr_bq">
Program hanya menampilkan nilai a kurang dari 5.</blockquote>
<ul style="text-align: left;">
<li><b>while </b>: perulangan while digunakan pada saat kita tidak mengetahui jumlah perulangan yang akan dilakukan tapi mengetahui kondisi atau syarat dilakukan perulangan.</li>
</ul>
<blockquote class="tr_bq">
Contoh : </blockquote>
<blockquote class="tr_bq">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow"><img border="0" height="130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghXOyH82Fx8XGd8GQOQJJ5tmKhLsBzRuAk6C01auKnwSgQk5_4k3haKyaTx9ofemo1rI4hc1wBMtg2tvqZgq7D3W-KcqzrP9OBHsWsiwd14ymXQp80nGbWhZDIiTCiohYjsdWxmItyTDA/s320/while.png" width="320" /></a></blockquote>
<blockquote class="tr_bq">
sintaks perulangan while berbeda dengan for, di dalam kurung hanya ada kondisi, jika dengan for harus ada variabel, kondisi, dan pengubah. Dan pengubah berada didalam perulangan (<span style="font-family: Courier New, Courier, monospace;">a++</span>) </blockquote>
<blockquote class="tr_bq">
Output : </blockquote>
<blockquote class="tr_bq">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow"><img alt="perulangan while" border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioXw0KDhwkjEXz_GuTV90fw7SBTQ74lND2xFDN354bP0ALB1mGiIrFrfiHS3BucyVRvS6_t-s2BG8M571G84Qlh7eOEDfo6cxwIy6Bhs0WnsG0PuaRHCivvfXnYugC8LSRLBtuSZq6Pzw/s320/for+print.png" title="perulangan while" width="320" /></a></blockquote>
<blockquote class="tr_bq">
Output sama dengan perulangan for.</blockquote>
<ul style="text-align: left;">
<li><b>do-while : </b> perulangan yang hampir sama dengan while namun, pernyataan akan dilakukan terlebih dahulu kemudian dilakukan pengecekan.</li>
</ul>
<blockquote class="tr_bq">
Contoh : </blockquote>
<blockquote class="tr_bq">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow"><img alt="perulangan do while" border="0" height="133" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG2LH9426ruKGbZkonmqEGrjxcBTMRsLesxgvpp42totvDzbJ8YRsO-VKlIq4qoIjjVwE8SbtcrwKb8o-Gll79Rcb6wLwB0ILe85A1j4m0gI8jtvPfGB8Hk-IHNBvpuw-MYxVoeaQaIag/s320/do+while.png" title="perulangan do while" width="320" /></a> </blockquote>
<blockquote class="tr_bq">
perhatikan! penggunaan while diletakan diakhir itu artinya pengecekan kondisi dilakukan pada akhir. </blockquote>
<blockquote class="tr_bq">
Output : </blockquote>
<div class="separator" style="clear: both; text-align: center;">
</div>
<blockquote class="tr_bq">
<a href="http://agungimam.blogspot.com/2013/04/perulangan-java-for-while-dan-do-while.html" rel="nofollow" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img alt="perulangan do while" border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEioXw0KDhwkjEXz_GuTV90fw7SBTQ74lND2xFDN354bP0ALB1mGiIrFrfiHS3BucyVRvS6_t-s2BG8M571G84Qlh7eOEDfo6cxwIy6Bhs0WnsG0PuaRHCivvfXnYugC8LSRLBtuSZq6Pzw/s320/for+print.png" title="perulangan do while" width="320" /></a></blockquote>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Sekian untuk tutorial hari ini, mari berbagi, karena berbagi itu menyenangkan.<br />
sekilas motivasi :"<i>Semakin banyak persiapanmua semakin banyak keberhasilanmu"~Terry Josephson.</i><br />
<br /></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com18tag:blogger.com,1999:blog-1578778833455333312.post-89827626922367027582013-04-27T15:35:00.001+07:002013-04-27T15:35:51.645+07:00Bilangan Prima Terbesar<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/bilangan-prima-terbesar.html" rel="nofollow"><img alt="prima terbesar" border="0" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKQbsesL2fbw7yVueNl9rCQBJwi9vmRNxCJ_bQdmebVwvStfF2RuTS8LERX7wGTh6Tn3jlz59FRRQ2J-j37UBqWqlKiD4EfwrGQL6TB7b2juYMPrPOYyYeNRSHxkB23WPsR7_G87gqaKk/s320/number.jpeg" title="prima terbesar" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif";">Bilangan
prima terbesar. Tahukah anda bilangan prima terbesar sampai saat ini? Pertama, saya
akan menjelaskan alasan saya menggunakan kata ”sampai saat ini”, ini karena dari
tahun ketahun penemuan bilangan prima terbesar ini selalu berkembang. Tapi saya
dapat dari wikipedia, bahwa bilangan prima terbesar adalah bilangan bulat
terbesar yang diketahui. Jadi </span><br />
<a name='more'></a><span style="font-family: "Times New Roman","serif";">dapat disimpulkan bahwa bilangan prima terbesar
itu tidak ada karena bilangan prima karena jumlahnya tak hingga. Hingga saat
ini bilangan prima terbesar yang diketahui adalah bilangan prima yang memiliki <b>17.425.170</b> digit. Bilangan ini
ditemukan oleh matematikawan dari Amerika, Curtis Cooper dari University of
Central Misssouri di Warrensburg.
Bilangan ini adalah <b>2 pangkat 57.885161 minus 1</b>. Penemuan bilangan prima
ini adalah hasil dari proyek <i>Great Internet
mersenne Prime Search </i>(Pencarian Internet Bilangan Prima Terbesar Mersenne).
Berkat penemuannya ini Cooper mendapat
hadiah sebesar US$3.000 dan juga <i>Electronic
Frontier Foundation. Electronic Frontier
Foundation</i> adalah penghargaan yang diberikan untuk individu atau kelompok yang berhasil menemukan
bilangan prima terbesar. Sumber dari wikipedia, bahwa <i>Electronic Frontier Foundation </i> selanjutnya akan diberikan kepada penemu yang
berhasil menemukan bilangan prima setidaknya memiliki panjang 100 juta digit. Sekian
untuk <i>post </i> kali ini mari berbagi, karena berbagi itu
menyenangkan.<o:p></o:p></span><br />
<span style="font-family: "Times New Roman","serif";">referensi : www.wikipedia.co.id, www.tempo.co, www.zmescience.com </span></div>
<div class="MsoNormal">
<span style="font-family: "Times New Roman","serif";">Sekilas motivasi
: “<i>Kesalahan fatal adalah memasuki kancah peperangan tanpa kemauan ntuk menang</i>”~<i>Douglas Mac Arthur</i><o:p></o:p></span></div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com2tag:blogger.com,1999:blog-1578778833455333312.post-48032813266868382172013-04-27T15:35:00.000+07:002013-04-27T15:35:31.550+07:00Cara menggunakan gnu plot<div dir="ltr" style="text-align: left;" trbidi="on">
Hello Sobat blogger kali ini saya akan nge<i>post</i> mengenai cara menggunakan aplikasi gnu plot. Saya nge<i>post</i> ini karena kemarin teman saya minta tutorial tentang aplikasi ini. Sebelum saya jelaskan cara menggunakan aplikasi ini, mari kita cari tau apa itu gnu plot. Program ini dikenalkan pada tahun <b>1986</b>. Pada awalnya program ini diturunkan dari program yang berasal sistem operasi Unix. Gnu plot adalah program grafik yang berbasis CLI (<i>command-line interface</i>). Berikut penggunaan gnuplot secara sederhana.<br />
<a name='more'></a><br />
masukan x <i>range </i>yang kita inginkan, misalnya antara 0 sampai 5<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/cara-menggunakan-gnu-plot.html" rel="nofollow"><img alt="gnu plot" border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgt-gYNO9dWA4hd8Jm4MjAepFasYV64NDgt6MMj9cmxjZbw4gekx2VALEWBHjTGukvAodPG8-dBgHlhIdFV2bDrXpdWGhhZIEaw3Mb1aABIqJI71AMyBe-jhfF-LP2vh-l8ukiTQ-F9eY4/s1600/gnuplottut1.png" title="gnu plot" width="400" /></a></div>
masukan y <i>range </i>yang kita inginkan, misal antara -2 sampai 2<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/cara-menggunakan-gnu-plot.html" rel="nofollow"><img alt="gnu plot" border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMlsIAvv71v3f4WCdM0FHp6KcUEEzrCJleWXBcC-RFDFwAWEr1QxqrYdsopUGunIqUb39E_QRRts4aINVxVaacMVOA03hkEK5WoLTmAtnl-JMKFph_Fwsi0Qka-g1VJcU-hj_hlqZTV5s/s1600/gnuplottut2.png" title="gnu plot" width="400" /></a></div>
selanjutnya masukan persamaan yang kamu inginkan dengan perintah <i>plot, </i>misal sinx<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/cara-menggunakan-gnu-plot.html" rel="nofollow"><img alt="gnu plot" border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwUrKHOVWRy960SW7D7ASVtFSQyijv4mHlaw1I7Q5-QZKQ31eL9zDO9H9gf4JpFfDVyxEWYTIfksQKYHJT2QLM_2Mh2EDIaPcG68r6z1CraNTbRpOmg-jguJtrDNFSq5_1vKw17rVM2s4/s1600/gnuplottut3.png" title="gnu plot" width="400" /></a></div>
setelah itu tekan enter, maka akan menghasilkan output seperti ini<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/cara-menggunakan-gnu-plot.html" rel="nofollow"><img alt="gnu plot" border="0" height="288" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAh69kZMMrSHOLScYoYnQjNZA7c7LYaVXYH-OQ5U8PPkPcq8E6tuftyPXX65AYxv_4roS4DPm6677UKfLIXGF2ippCoD-zgDPbdkVPYxgbMhP8TzGin0oKQBKapJU7GBPGwBp9TUa0M3M/s1600/gnuplottut4.png" title="gnu plot" width="400" /></a></div>
sekian sobat untuk tutorial kali ini, semoga bermanfaat. Berbagi itu menyenangkan.</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com1tag:blogger.com,1999:blog-1578778833455333312.post-85496501625035104722013-04-26T19:20:00.000+07:002013-04-27T15:35:12.754+07:00Algoritma Source Code Metode Tabel<div dir="ltr" style="text-align: left;" trbidi="on">
Metode Tabel adalah salah satu metode dalam metode numerik yang digunakan untuk mencari akar dari suatu persamaan. Prinsip dari Metode Tabel ini adalah memasukan nilai x antara batas tertentu (batas atas dan batas bawah) kedalah suatu fungsi, jika nilai fungsi (fx) mendekati nilai nol maka nilai x itulah yang dianggap sebagai akar persamaan. Metode ini sangat lemah, artinya metode ini memiki keakuratan yang sangat kurang dan sangat sulit untuk mendapatkan nilai eror yang kecil. Penggunaan metode ini biasanya untuk mencari nilai pendekatan awal pada metode metode lain seperti newton rapson atau pun metode secant. Berikut adalah algoritma dan Source Code metode Tabel.<br />
<a name='more'></a><br />
Algoritma :<br />
<br />
<ol style="text-align: left;">
<li>Definisikan fungsi fx (misal y=x^2 -27);</li>
<li>Tentukan batas bawah, batas bawah nilai x dan jumlah iterasi;</li>
<li>Hitung penambahan nilai x dengan rumus inc = (batas atas - batas bawah ) / jumlah iterasi;</li>
<li>Apakah batas bawah < dari batas atas? ya: langkah 5-9, tidak : langkah 11;</li>
<li>hitung nilai f(batas bawah);</li>
<li>hitung nilai f(atas atas ditambah inc);</li>
<li>Cetak nilai batas bawah dan nilai f(batas bawah);</li>
<li>Apakah nilai f(b.bawah) dikali f(b.bawah + inc) kurang dari 0? Ya : simpan nilai b.bawah dan b.bawah +inc;</li>
<li>Tambah nilai batas bawah dengan inc;</li>
<li>kembali ke langakh 4;</li>
<li>Cetak nilai batas bawah yang disimpan dan batas bawas + inc;</li>
</ol>
<div>
Source code :</div>
<div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#include <stdio.h></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#include <math.h></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">#include <stdlib.h></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">double fungsi (double);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">main(){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double x1, x2, fx1, fx2, a, temp, indeks;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int n, i=1;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts(">>>> METODE TABEL <<<<");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts(" f(x)=x^2 - 27 ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan batas bawah : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%lf", &x1);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan batas atas : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%lf", &x2);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("Masukan banyak iterasi : ");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>scanf("%d", &n);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>a = (x2-x1) / n;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx1 = fungsi(x1);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx2 = fungsi(x2);</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (fx1*fx2>=0){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("batas atas dan bats bawah Anda salah\n");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp = x1;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>puts(" x\t\tfx");</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>do{</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx1 = fungsi(temp);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx2 = fungsi(temp+a);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("%9lf %9lf\n",temp, fx1);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (fx1*fx2<=0)</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>indeks = temp;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>fx1 = fx2;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp = temp + a;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>i++;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}while(i<=n);</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>printf("\nHasil berada diantara %lf dan %lf\n",indeks, indeks+a );</span></div>
<div>
<span class="Apple-tab-span" style="white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">double fungsi (double a){</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>double hasil;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span><span style="color: red;">hasil =a*a - 27;</span></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><br /></span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>return hasil;</span></div>
<div>
<span style="font-family: Courier New, Courier, monospace;">}</span></div>
</div>
<div>
Warna merah merupakan fungsi yang bisa dirubah sesuai keinginan.</div>
<div>
Maka output yang dihasilkan akan seperti berikut : </div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/algoritma-source-code-metode-tabel.html" rel="nofollow"><img alt="Algoritma source code metode tabel" border="0" height="285" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiieP-B-3oJmOev3ibnp8ADip2MeVUDv3CqTVJqXmadNZ4kAiFwXGAvbqvcStos9fw_vyqDFebAcAWV9GU_D5lTfKJCDi4awzNmPFhZrBI8pSwuNw5OaJtRw-m6AJa1SfMocQ3M9DxdJ9Y/s400/tabel+metnum.png" title="Algoritma source code metode tabel" width="400" /></a></div>
<div>
Semoga bermanfaat, jangan lupa untuk dibagikan ke teman-temannya. Karena berbagi itu menyenangkan.</div>
<div>
<i>"Jika kamu sudah bisa menciptakan kebahagian didalam dirimu, kamu akan bisa menemukan kebahagiaan itu di tempat mana pun:~Galaiola Montana</i></div>
<div>
<br /></div>
</div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com2tag:blogger.com,1999:blog-1578778833455333312.post-15359074225871635952013-04-23T22:11:00.003+07:002014-03-13T22:48:25.398+07:00Algoritma dan Source Code Bilangan prima<div dir="ltr" style="text-align: left;" trbidi="on">Assalamualaikum warrohmatulahi wabarokatuh. Hello sobat blogger. Sobat tahu bilangan prima? Kali ini saya mau nge<i>post </i>mengenai tentang bilangan prima. Sebelum membahas jauh tentang Algoritma dan Source code, kita pahami dahulu definisi dari bilangan prima. Bilangan <b>prima</b> adalah bagian dari himpunan bilangan bulat positif lebih dari satu dan hanya mempunyai dua faktor, yaitu bilangan 1 dan bilangan itu sendiri. Sedangkan bagaimana mengenai bilangan yang bukan bilangan prima. <i>Nah </i>bilangan-bilangan selain bilangan prima disebut bilangan <b>komposit. </b>Dimulai dengan sejarah bilangan prima, <span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Sejarah bilangan prima dimulai pada zaman Mesir Kuno. Ini dibuktikan dengan </span><br />
<a name='more'></a><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">ditemukannya sebuah catatan yang menyatakan penggunaan bilangan prima pada zaman tersebut. Tapi bilangan prima dan komposit</span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">pada saat itu </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"> </span><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">berbeda dengan bilangan prima dan komposit yang kita kenal sekarang ini. Bukti lain juga ditemukan catatan lain mengenai bilangan prima pada zaman Mesi Kuno. Berikut Algoritma dan Source Code Bilangan prima.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Algoritma :</span><br />
<br />
<ol style="text-align: left;"><li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Masukan jumlah bilangan prima yang akan di cetak (n);</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Inisialisasi temp = benar;</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Untuk b =2;</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Jika bilangan % b = 0 : Temp = salah, keluar perulangan</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Naikan nilai b;</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Jika nilai b< bilangan: kembali ke 4, tidak : keluar perulangan;</span></li>
<li><span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 18px; text-indent: -18pt;"><span style="font-family: 'Times New Roman'; font-size: 7pt; line-height: normal;"> </span></span><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Jika temp = benar : cetak nilai bilangan, naikan jumlah bilangan prima yang sudah dicetak;</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Naikan bilangan +1;</span></li>
<li><span style="font-family: 'Times New Roman', serif; text-indent: -18pt;">Apakah bilangan prima yang dicetak kurang dari n? Ya : kembali ke no 2; tidak : keluar</span></li>
</ol><br />
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Source code : </span><br />
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><br />
<!-- 728x90 bawah post --><br />
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-7731065252516422"
data-ad-slot="3294974391"></ins><br />
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;">import javax.swing.JOptionPane;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;">public class Prima {</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>public static void main(String args[]){</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>int n, a=2, b,jum=0;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>boolean temp;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>String angka = JOptionPane.showInputDialog("Masukan nilai n : ");</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>n = Integer.parseInt(angka);</span></span><br />
<span class="Apple-tab-span" style="line-height: 18px; white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.println("Nilai n = "+n);</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>while(jum<n){</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp = true;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>for(b=2;b<a;b++){</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (a%b==0){</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>temp = false;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>break;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>if (temp==true){</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>System.out.print(a+" ");</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>jum++;</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>a++;</span></span><br />
<span class="Apple-tab-span" style="line-height: 18px; white-space: pre;"><span style="font-family: Courier New, Courier, monospace;"> </span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></span><br />
<span style="line-height: 18px;"><span style="font-family: Courier New, Courier, monospace;">}</span></span><br />
<br />
<div style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">hasil akan seperti berikut :</div><div class="separator" style="clear: both; text-align: center;"><a href="http://agungimam.blogspot.com/2013/04/algoritma-dan-source-code-bilangan-prima.html" rel="nofollow" target="_blank"><img alt="bilangan prima" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWf-CSDRu0V-kpap-dN1EUqMSjoHJ_xM4SlMUv0bBkma11lLr6XYylC34MPfQI1Fu19MSWl-EoDtCVvEifQgy8-BwPfkDv4EkMWTfmFBuT42HBIy91IR_FGvRdubN736eTU4imR7CQoGo/s400/primaout.png" height="142" title="bilangan prima" width="400" /></a></div><div style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;"><br />
</div><br />
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">sekian dari tutorial kali ini semoga bermanfaat. berbagi memang menyenangkan.</span><br />
<span style="font-family: 'Times New Roman', serif; font-size: 12pt; line-height: 115%;">Sekilas motivasi : "</span><span style="font-family: 'Times New Roman', serif;"><i>Perubahan adalah hukum kehidupan. Oleh karena itu , siapa yang hanya melihat masa lalu dan hari ini, pastilah akan kehilangan masa depannya</i>."<i>~ John F. Kennedy</i></span><br />
<div class="MsoNormal"><span style="font-family: "Times New Roman","serif";"><o:p></o:p></span></div><br />
<div class="MsoListParagraphCxSpLast" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;"><o:p></o:p></div></div>Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com0tag:blogger.com,1999:blog-1578778833455333312.post-63940853392846991842013-04-21T21:22:00.001+07:002019-01-22T09:36:07.983+07:00Percabangan Java if, else-if, if-else, switch<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://agungimam.blogspot.com/2013/04/percabangan-java-if-else-if-if-else.html" rel="nofollow" style="margin-left: 1em; margin-right: 1em;"><img alt="Percabangan java" border="0" height="362" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNzUFnAbh3ggrZw-Kclc9kRBfCT3EfcV7Xb1CpOVHDUKBNELVUVpAnsmNVRgkW5hwkHyDzlC6sUTPJuToFqXa3VGvtZL2JFMV4zxLnfC3TSb-nauYlIUpXT0KjRMUWinVM9WEvHzIPeQE/s400/Percabangan+java.png" title="Percabangan java" width="400" /></a></div>
Percabangan adalah suatu pilihan atau opsi dengan kondisi tertentu. Jika kondisi yang menjadi syarat terpenuhi, maka opsi atau pilihan dijalankan, jika tidak maka sebaliknya. Dalam java terdapat 4 macam jenis percabangan, if, if-else, else-if, dan juga switch. Keempat jenis ini memiliki penggunaan masing-masing. Berikut penjelasan mengenai penggunaan tiap-tiap percabangan :<br />
<a name='more'></a><br />
<br />
<ul style="text-align: left;">
<li><b>if </b>: Percabangan if ini digunakan jika kita hanya memiliki <b>satu pernyaatan </b>yang akan dijalankan dengan syarat tertentu. Sintaks if seperti berikut :</li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if(kondisi){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">pernyataan</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">} </span></blockquote>
<blockquote class="tr_bq">
Jika kondisi benar, maka pernyataan akan dijalankan.</blockquote>
<blockquote class="tr_bq">
Contoh : </blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public class coba{</span></blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public static void main (String [] args){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">int a=0;</span><span style="font-family: "courier new" , "courier" , monospace;"> </span></blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if (a==0)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 0");</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if (a==1)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 1");</span></blockquote>
</blockquote>
</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></blockquote>
</blockquote>
<blockquote class="tr_bq">
Output : Program akan menampilkan nilai a = 0 saja, karena pada if yang kedua, kondisi tidak memenuhi atau salah. </blockquote>
<ul style="text-align: left;">
<li><b>if else</b> : Percabangan if else digunakan saat kita memiliki <b>dua pernyataan</b> dengan syarat tertentu. Sintaks if-else seperti berikut :</li>
</ul>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if(kondisi){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">pernyataan1</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}else{</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">pernyataan2</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></blockquote>
<blockquote class="tr_bq">
Jika hasil dari if benar, maka pernyataan1 yang dijalankan, sedangkan jika salah, pernyataan dua yang akan dijalankan.</blockquote>
<blockquote class="tr_bq">
Contoh : </blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public class coba{</span></blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public static void main (String [] args){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">int a=0;</span><span style="font-family: "courier new" , "courier" , monospace;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if (a==0)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 0");</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">else</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 1");</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></blockquote>
</blockquote>
<blockquote class="tr_bq">
Output : program akan menampilkan <i>nilai a = 0</i>, karena kondisi if bernilai benar, jika pada inisialisasi nilai a tidak bernilai 0, maka program akan menampilkan <i>nilai a = 1.</i></blockquote>
<br />
<ul style="text-align: left;">
<li> <b>else -if</b> : percabangan yang digunakan saat kita memiliki banyak kondisi (lebih dari 2) dan banyak pernyataan (lebih dari 2). Sintaks dari else-if seperti berikut :</li>
</ul>
<div>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if(kondisi){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">pernyataan1</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}elseif(kondisi2){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">pernyataan2</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}else(kondisi3){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">pernyataan3</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">} </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">else {</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">penyataan4</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">} </span></blockquote>
<blockquote class="tr_bq">
jika kondisi1 benar, maka pernyataan1 akan dijalankan, jika kondisi2 benar, maka penyataan2 akan dijalankan, jika semua kondisi salah, maka penyataan4 yang akan dijalankan saja.</blockquote>
<blockquote class="tr_bq">
Contoh :</blockquote>
</div>
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public class coba{</span></blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public static void main (String [] args){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">int a=2;</span><span style="font-family: "courier new" , "courier" , monospace;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">if (a==0)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 0");</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">else if(a==1)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 1");</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">else if(a==2)</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a = 2");</span> </blockquote>
</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></blockquote>
</blockquote>
<blockquote class="tr_bq">
Output : Program akan menampilkan <i>nilai a = 2 </i>saja, karena pada else-if yang ketiga atau dengan pernyataan <span style="font-family: "courier new" , "courier" , monospace;">a==2 </span><span style="font-family: "times" , "times new roman" , serif;">bernilai benar, sedangkan pernyataan yang lain tidak dijalankan karena kondisi tidak memenuhi.</span></blockquote>
<ul>
<li> <b>switch-case</b> : percabangan yang digunakan saat kita memiliki banyak kondisi (lebih dari 2) dan banyak pernyataan (ledbih dari 2). Sebenarnya switch-case ini hampir sama dengan else if, hanya saja sintaksnya yang berbeda. Sintaks dari switch-case seperti berikut :</li>
</ul>
<div>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">switch (variabel) { </span></blockquote>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>case nilai1: pernyataan1; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>break; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>case nilai2: pernyataan2; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>break; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>default: pernyataan3; </span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><span class="Apple-tab-span" style="white-space: pre;"> </span>}</span></div>
</div>
<blockquote class="tr_bq">
<span style="font-family: "times" , "times new roman" , serif;">Jika nilai variabel yang ditunjuk bernilai sesuai nilai1, maka pernyataan1 akan dijalankan, jika nilai variabel yang ditunjuk bernilai sesuai nilai2, pernyataan2 dijalankan, jika tidak ,maka pernyataan3 yang akan dijalankan.</span></blockquote>
<br />
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public class coba{</span></blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">public static void main (String [] args){</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">int a=3;</span><span style="font-family: "courier new" , "courier" , monospace;"> </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">switch (a) { </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> case 1: </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("</span><span style="font-family: "courier new" , "courier" , monospace;">Nilai a=1</span><span style="font-family: "courier new" , "courier" , monospace;">");break;</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> case 2: </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("Nilai a=2"); break;</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> case 3: </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("</span><span style="font-family: "courier new" , "courier" , monospace;">Nilai a=3</span><span style="font-family: "courier new" , "courier" , monospace;">");break;</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> default: </span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> System.out.println("</span><span style="font-family: "courier new" , "courier" , monospace;">Nilai a=4</span><span style="font-family: "courier new" , "courier" , monospace;">"); break</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></blockquote>
</blockquote>
<blockquote class="tr_bq">
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;"> }</span></blockquote>
<blockquote class="tr_bq">
<span style="font-family: "courier new" , "courier" , monospace;">}</span></blockquote>
</blockquote>
<blockquote class="tr_bq">
Output : Program akan menampilkan <i>nilai a = 2 </i>saja, karena kondisi bernilai benar<span style="font-family: "times" , "times new roman" , serif;">, perhatika break dibelakang pernyataan, jika break ini dihapus, maka semua pernyataan akan dijalankan. Break digunakan untuk keluar dari switch-case saat 1 pernyataan sudah dijalankan.</span></blockquote>
Sekian tutorial hari ini, semoga bermanfaat, jangan lupa untuk berbagi, berbagi itu menyenangkan.<br />
Sekilas motivasi :<i>"Orang yang bijak bukan karena pengalaman, tetapi karena kapasitasnya dalam memaknai pengalaman:~Bernand Show</i></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com20tag:blogger.com,1999:blog-1578778833455333312.post-87975245816613837992013-04-18T17:54:00.003+07:002013-04-27T15:41:00.916+07:00Mencegah Konvergen Metode Newton Raphson<div dir="ltr" style="text-align: left;" trbidi="on">
<a href="http://agungimam.blogspot.com/2013/04/mencegah-konvergen-metode-newton-raphson.html" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: center;" target="_blank"><img alt="newton rapson" border="0" height="270" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgdua6xdlIRVsITsJI-rqneZhwlIMN8Q9oXkZwC9zTYCNJPScS1eeh-thOAYSAxrLsdmje51wvog5lcSD_trGrPfL7k6YcIfxwHLrx5WtCASKJAnqzejtWMzjmn5Zshf54b12A4sEcACCk/s1600/new+newton+raphson.png" title="newton rapson" width="320" /></a><br />
Assalamualaikum warrohmatullahi wabarokatuh.<br />
Kali ini saya mau ngepost mengenai optimalisasai <a href="http://agungimam.blogspot.com/2013/04/metode-newton-raphson-algoritma-dan.html" rel="nofollow" target="_blank">Metode Newton Raphson</a> atau mencegah divergen (saat kita menggunakan <a href="http://agungimam.blogspot.com/2013/04/metode-newton-raphson-algoritma-dan.html" rel="nofollow" target="_blank">Metode Newton Raphson</a> namun tidak menemukan akar dari penyelesaian) pada <a href="http://agungimam.blogspot.com/2013/04/metode-newton-raphson-algoritma-dan.html" rel="nofollow" target="_blank">Metode Newton Raphson</a> dengan menggunakan metode Tabel. Prinsip dari metode ini adalah menggunakan Metode Tabel terlebih dahulu dengan memasukan nilai batas atas dan batas bawah. kemudian nilai x dari hasil metode tabel tersebut menjadi nilai awal pada Metode Newton Raphson. berikut adalah algoritma dan <i>Source Code</i> nya :<br />
<a name='more'></a><br />
<br />
<br />
Algoritma :<br />
<br />
<ol>
<li><span style="font-family: "Times New Roman","serif";">Definisikan
fungsi x(f(x) dan turunan fungsi x (g(x));</span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"> </span></span></span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";">
</span></span></span><span style="font-family: "Times New Roman","serif";">Masukan
nilai awal x, toleransi error, dan jumlah iterasi, batas awal (a) dan batas
akhir(b);</span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"></span></span></li>
<li><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Inisialisasi
i =0, k=0,j=0,temp=0;</span><span style="font-family: "Times New Roman","serif";"> </span></li>
<li><span style="font-family: "Times New Roman","serif";">Inisialisasai
fx[ ][ ], gx[ ][ ], abso[ ][ ], fx_temp1, fx_temp2, a,b,inc;</span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";"> </span></li>
<li><span style="font-family: "Times New Roman","serif";">Tentukan
increment metode tabel inc = (b-a)/2;</span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";"> </span></li>
<li><span style="font-family: "Times New Roman","serif";">Apakah
nilai i kurang dari sama dengan n-1?jika tidak keluar dari perulangan </span><span style="font-family: Wingdings; mso-ascii-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-char-type: symbol; mso-hansi-font-family: "Times New Roman"; mso-symbol-font-family: Wingdings;"><span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings;">à</span></span><span style="font-family: "Times New Roman","serif";"> indeks 13;</span> <span style="font-family: "Times New Roman","serif";"> </span></li>
<li><span style="font-family: "Times New Roman","serif";">Fx_temp1=
fungsix(a);</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Tambah
nilai a dengan inc;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Fx_temp2
= fungix(a);</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Cetak nilai a dan fx_temp1;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Jika fx_temp1 dikali fx_temp2
kurang dari 0; simpan a kedalam x[j][k], increment nilai j;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Increment nilai i; kembali ke 6;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Inisialisasi temp = 0;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Apakah temp kurang dari j? Jika
tidak keluar dariperulangan</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Inisialisasi i =0;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Apakah i kurang dari n? Jika
tidak keluar perulangan</span><span style="font-family: Wingdings; mso-ascii-font-family: "Times New Roman"; mso-bidi-font-family: "Times New Roman"; mso-char-type: symbol; mso-hansi-font-family: "Times New Roman"; mso-symbol-font-family: Wingdings;"><span style="mso-char-type: symbol; mso-symbol-font-family: Wingdings;">à</span></span><span style="font-family: "Times New Roman","serif";">indeks 24</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Fx[temp][i] = fungsix(x[temp][i]);</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Gx[temp][i] = tururanx f([temp]x[i])</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">Abso[temp][i] = fx[temp][i];</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">jika fx[i]<0 data-blogger-escaped-abso="" data-blogger-escaped-i="" data-blogger-escaped-span="" data-blogger-escaped-temp=""><!--0--><!--0--><!--0--></span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Cetak nilai x[temp][i], fx[temp][i],
gx[temp][i];</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif"; mso-fareast-font-family: "Times New Roman";"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"></span></span></span><span style="font-family: "Times New Roman","serif";">i++;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Jika abso[temp][i] kurang dari e
(toleransi error);</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Ya : Keluar perulangan;</span></li>
<li><span style="font-family: "Times New Roman","serif";"> </span><span style="font-family: "Times New Roman","serif";">Tidak
: kembali ke 16</span>.</li>
</ol>
berikut adalah Source Code dari program diatas :<br />
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]--><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>IN</w:LidThemeOther>
<w:LidThemeAsian>JA</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
<w:UseFELayout/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<br />
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">#include
<stdio .h=""></stdio></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">#include
<math .h=""></math></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">#define max 20</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">double
fungsix(double);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">double
diffungsix(double);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">main(){</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>double x[max][max]={0.5}, fx[max][max],
gx[max][max], e=0.0001,abso[max][max], fx_tab1, fx_tab2; //gx merupakan turunan
fx </span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>int i =0, n=10,j=0,k=0, temp=0;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>double a=0.9,b=5, inc;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>puts("\t>>>METODE TABEL dan
NEWTON RAPSON<<<");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>puts("\t\t<span style="mso-spacerun: yes;"> </span>f(x)=x+e^x");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>printf("Masukan nilai awal<span style="mso-spacerun: yes;"> </span>: ");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>scanf("%lf", &a); </span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>printf("Masukan nilai akhir<span style="mso-spacerun: yes;"> </span>: ");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>scanf("%lf", &b);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>printf("Masukan nilai error<span style="mso-spacerun: yes;"> </span>: ");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>scanf("%lf", &e);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>printf("Masukan jumlah iterasi :
");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>scanf("%d", &n);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>inc = (b - a) / n;<span style="mso-tab-count: 1;"> </span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>puts(" no<span style="mso-spacerun: yes;"> </span>x\t<span style="mso-spacerun: yes;">
</span>fx");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>while(i<=(n-1)){</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>fx_tab1 = fungsix(a);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>a+=inc;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>fx_tab2 = fungsix(a);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>printf("%3d<span style="mso-spacerun: yes;"> </span>%7lf<span style="mso-spacerun: yes;">
</span>%9lf \n",i+1,a-inc, fx_tab1);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>if (fx_tab1*fx_tab2 < 0){</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>x[j][k] = a-inc;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>j+=1;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>}</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>i++;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>}</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>temp=0;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>while(temp<j span=""></j></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>i=0;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>puts("=================================================================");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>printf("| n |<span style="mso-spacerun: yes;"> </span>x<span style="mso-spacerun: yes;">
</span>|<span style="mso-spacerun: yes;"> </span>fx<span style="mso-spacerun: yes;"> </span>|<span style="mso-spacerun: yes;">
</span>gx<span style="mso-spacerun: yes;"> </span>|<span style="mso-spacerun: yes;"> </span>absolut fx<span style="mso-spacerun: yes;">
</span>|\n");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>puts("=================================================================");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>while(i<=n){</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>fx[temp][i] =
fungsix(x[temp][i]);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>gx[temp][i] =
diffungsix(x[temp][i]);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>x[temp][i+1]= x[temp][i] -
(fx[temp][i]/gx[temp][i]);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>abso[temp][i] = fx[temp][i];</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>if(abso[temp][i]<0 data-blogger-escaped-span=""><!--0--><!--0--><!--0--></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 4;"> </span>abso[temp][i] *=-1;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>printf("|%2d | %12.9lf |
%12.9lf | %12.9lf | %12.9lf |\n",i+1, x[temp][i],
fx[temp][i],gx[temp][i],abso[temp][i]);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>if(abso[temp][i] < e)</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 4;"> </span>break;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 3;"> </span>i++;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>}</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>puts("=================================================================");</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>printf("Akar terletak di x
%9.9lf dengan nilai fx %9.9lf\n",x[temp][i], fx[temp][i]);</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 2;"> </span>temp++;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>}</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">}</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">double fungsix
(double a){ </span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>double hasil;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>hasil = a*exp(-a) + cos(2*a);<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">//merupakan fungsix (fx) yang bisa kamu masukan sendiri</span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>return hasil;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">}</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">double diffungsix
(double b){ </span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>double hasil2;</span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>hasil2 = (1-b)*exp(-b) - 2 * sin(2*b); <span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;">// merupakan fungsi turunan dari fungsi fx</span></span></div>
<div class="MsoNormal" style="margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 42.55pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-no-proof: yes;"><span style="mso-tab-count: 1;"> </span>return hasil2;</span></div>
<span style="font-family: "Courier New"; font-size: 9.0pt; line-height: 115%; mso-ansi-language: IN; mso-bidi-language: AR-SA; mso-fareast-font-family: "MS Mincho"; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes;">}</span><br />
<br />
Sekian dari <i>post</i> kali ini terimakasih telah berunjung, berbagi itu memang menyenangkan.<br />
sekilas motivasi : <i>"<span style="font-family: "Times New Roman","serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: IN; mso-bidi-language: AR-SA; mso-fareast-font-family: "MS Mincho"; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast;">Bukan kesuliatan yang membuat kita takut melangkah,
tetapi ketakutan itulah yang mempersulit"~Seneca </span></i><br />
<span style="font-family: "Times New Roman","serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: IN; mso-bidi-language: AR-SA; mso-fareast-font-family: "MS Mincho"; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast;">wassalamualaikum warrohmatulahi wabarokatuh.</span><i><span style="font-family: "Times New Roman","serif"; font-size: 11.0pt; line-height: 115%; mso-ansi-language: IN; mso-bidi-language: AR-SA; mso-fareast-font-family: "MS Mincho"; mso-fareast-language: JA; mso-fareast-theme-font: minor-fareast;"> </span></i></div>
Agung Imamudinhttp://www.blogger.com/profile/01549052746437502780noreply@blogger.com0