Al Ikhlas

1. Katakanlah : Dia-lah Allah, Yang Maha Esa 2. Allah adalah Tuhan yang bergantung kepada-Nya segala sesuatu 3. Dia tiada beranak dan tidak pula diperanakkan 4. Dan tidak ada seorangpun yang setara dengan Dia (Al-Qur'an Surat Al-Ikhlas 112)

Selasa, 16 Juni 2015

program slider sederhana "java"


import java.awt.*;

import java.awt.event.*;

import javax.swing.*;
import javax.swing.event.*;

public class SimpleSliderDemo extends JFrame {
private JSlider slider;
private JTextField txtValue;
public SimpleSliderDemo() {
super ("JSlider Sederhana");

Container container = getContentPane();
container.setLayout(new FlowLayout());

txtValue = new JTextField (20);
txtValue.setBackground(Color.WHITE);
txtValue.setEditable(false);

slider = new JSlider(SwingConstants.HORIZONTAL,0,100,50);
txtValue.setText(String.valueOf(slider.getValue()));
slider.setMinorTickSpacing(5);
slider.setMajorTickSpacing(20);
slider.setPaintTicks(true);
slider.setLabelTable(slider.getLabelTable());
slider.setPaintLabels(true);

slider.addChangeListener (
new ChangeListener() {
public void stateChanged (ChangeEvent e) {
txtValue.setText ( String.valueOf(slider.getValue()) );
}
}
);
container.add(txtValue);
container.add(slider);
setSize (280,200);
setVisible (true);
}
public static void main (String args[]) {
JFrame.setDefaultLookAndFeelDecorated(true);
SimpleSliderDemo test = new SimpleSliderDemo();
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}


Senin, 15 Juni 2015

program painter, menggambar sederhana "java"


import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class Painter extends JFrame {
private int pointCount = 0;
private Point points[] = new Point[1000];

public Painter () {
super ("Program menggambar sederhana");

getContentPane().add(new JLabel("Drag mouse to draw"), BorderLayout.SOUTH);
addMouseMotionListener (
new MouseMotionAdapter() {
public void mouseDragged (MouseEvent e) {
if (pointCount < points.length) {
points[pointCount] = e.getPoint();
++pointCount;
repaint();
}
}
} //end of anonymous class
); //end method addMotionListener
setSize (300,150);
setLocationRelativeTo(null);
setVisible(true);
}

public void paint (Graphics g) {
super.paint(g);
for (int i = 0; i < points.length && points[i] != null; i++) {
g.setColor(Color.blue);
g.fillOval (points[i].x, points[i].y, 4,4);
}
}

public static void main (String args[]) {
Painter test = new Painter();
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}

Kamis, 11 Juni 2015

program parkir sederhana java

import java.util.Scanner;
public class parkir {

public static void main (String[] args) {
System.out.println("Program Parkir");
Scanner input = new Scanner(System.in);
String plat;
double datang;
double keluar;
double lamaparkir;
double biaya;
System.out.print("Masukan Nomor Plat Nomor Anda: ");
plat = input.next();
System.out.print("Masukan Jam Datang: ");
datang = input.nextInt();
System.out.print("Masukan Jam Keluar: ");
keluar = input.nextInt();
lamaparkir=(keluar-datang)/100;
biaya=lamaparkir*1000;
System.out.println("Tarif Parkir per Jam = Rp. 1000,00");
System.out.println("Lama parkir: "+lamaparkir);
System.out.println("Total yang Harus Dibayar: "+biaya);
}
}

Senin, 08 Juni 2015

Program Sederhana Menghitung gaji Karyawan "java"

//Program Sederhana Menghitung gaji Karyawan "java"

/**
* @(#)karyawan.java
*
*
* @author
* @version 1.00 2015/6/8
*/


public class karyawan {



public static void main(String[] args){
String NIK="2010000887";
String namaKaryawan="Uciha Itachi";
String alamatKaryawan="Konoha Gakure";
String jabatan="Member Of Akatsuki";
double gajiPokok=7800000;
double tunjangan=900000;
double gajiKotor=0;
double pajakPenghasilan=0;
double potongan=0;
double gajiBersih=0;

//proses
gajiKotor=gajiPokok+tunjangan;
pajakPenghasilan=0.20*gajiKotor;
potongan=0.01*gajiKotor;
gajiBersih=gajiKotor-pajakPenghasilan-potongan;

//menampilkan isi variabel
System.out.println ("Data Karyawan PT.AkatSuki");
System.out.println ("NIK:"+NIK);
System.out.println ("Nama Karyawan:"+namaKaryawan);
System.out.println ("Alamat Karyawan:"+alamatKaryawan);
System.out.println ("Jabatan:"+jabatan);
System.out.println ("Gaji Pokok:"+gajiPokok);
System.out.println ("Tunjangan:"+tunjangan);
System.out.println ("Gaji Kotor:"+gajiKotor);
System.out.println ("PPh:"+pajakPenghasilan);
System.out.println ("Potongan:"+potongan);
System.out.println ("Gaji Bersih:"+gajiBersih);
}
}

semoga bermanfaat.