Posts

Showing posts from June, 2014

kumpulan

klik   klik dua kali

Hitungan Matematika

*** MENGHITUNG LINGKARAN /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul7; import java.io.*; public class Soal1 {     public double luas_lingkaran(int diameter) {         int jari2=diameter/2; double luas=Math.PI * Math.pow(jari2,2); return luas; } public static void main(String[]args) { Soal1 mt=new Soal1(); System.out.println(mt.luas_lingkaran(20)); System.exit(0); }} *** LUAS LINGKARAN /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul7; /**   *   * @author pemrograman   */ import java.io.*; public class Soal1b { public double luas_lingkaran(int diameter) {         int jari = diameter / 2;         double luas = (3.14*jari*jari);         return luas;             }        public static void main(String[] args) throws IOException {          System.out.println(&

array multidimensi

*** ARRAY MULTI DIMENSI /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul6; /**   *   * @author anik nurul   */ public class tugas1 {     public static void main( String[] args ){ int data2[][]={{4,6,4,2,8,4,2,10},{4,6,4,2,8,4,2,10}}; for(int a=0;a<data2.length;a++){ for(int b=0;b<data2[0].length;b++){ System.out.print(data2[a][b]+" "); } System.out.print("\n"); } } }     *** MEMBUAT NAMA DENGAN ARAY MULTI DIMENSI /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul6; /**   *   * @author pemrograman   */ public class tugas2 {     public static void main(String[] args) {         String data[][] = {{"ABDUL\t085646668991\tKediri"}, {"KUSNO\t08564666899\tTrenggalek"}, {"PONIRAN\t085646668999\tBojonegoro"}};         int i =

Array

*** ARRAY /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul5; /**   *   * @author anik nurul   */ public class tugas1A {   public static void main (String []args){       int data []={4,6,4,2,8,4,2,10};       for (int a=0; a<data.length; a++)       {           System.out.print(data[a]+" ");       }   }       } *** ARRAY INPUT /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul5; /**   *   * @author anik nurul   */ import javax.swing.*; public class tugas1B {     public static void main(String[] args) {   int data []=new int [5];    for (int a=0; a<=data.length;a++)    {      data[a]=Integer.parseInt(JOptionPane.showInputDialog(null,"Masukkan Index ke "+a));        System.out.println("Index ke "+a+" adalah "+data[a]);      

PERULANGAN / LOOPING

Image
*** PERULANGAN /*   * To change this template, choose Tools | Templates   * and open the template in the editor.   */ package modul4; /**   *   * @author anik nurul   */ public class Tugas1 {     public static void main(String[] args) {     int jml=0; for(int i=1;i<=10;i++) { jml+=i; System.out.println(i); } System.out.println("Jumlah Semua Bilangan : "+jml);         } } *** MENGHITUNG PANGKAT DENGAN LOOPING package modul4; public class Tugas1a {     public static void main(String[]arg) { int jml=0; int a=1; int b=1; for(int i=1;i<=5;i++){     if (i<=2){         a*=5;} // 5 pangkat 2     if (i<=3) {         b*=4;   // 4 pagkat 3     }     jml=a+b; }   System.out.println("5pangkat2 + 4pangkat3 = "+jml); }   } *** MENGHITUNG FAKTORIAL DENGAN LOOPING /*   * To change this template, choose Tools | Templates   * and open the template in the editor.