3.22.2012

INPUT GAJI KARYAWAN

LISTING
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import javax.swing.*;

public class penggajian
{
public static void main(String[]args)
{
String nama=JOptionPane.showInputDialog("Masukan Nama");
int honorperjam = 0;
int honorlembur = 0;
int jamkerja = 0;
int gaji = 0;
int jamlembur = 0;
int jamtidaklembur = 0;
String pil;

JDialog.setDefaultLookAndFeelDecorated(true);
Object[] pilihan = {"Golongan A", "Golongan B", "Golongan C", "Golongan D"};
String initialSelection = "Golongan A";
String selection = JOptionPane.showInputDialog(
null, "Pilih Golongan Anda?",
"Input", JOptionPane.QUESTION_MESSAGE, null, pilihan, initialSelection).toString();

String lembur=JOptionPane.showInputDialog("Jumlah jam Kerja");
jamkerja= Integer.parseInt (lembur);

if (selection.equalsIgnoreCase("Golongan A"))
{
honorperjam = 8000;
honorlembur = 12500;
}
else if (selection.equalsIgnoreCase("Golongan B"))
{
honorperjam = 7000;
honorlembur = 10000;
}
else if (selection.equalsIgnoreCase("Golongan C"))
{
honorperjam = 6000;
honorlembur = 8500;
}
else if(selection.equalsIgnoreCase("Golongan D"))
{
honorperjam = 5000;
honorlembur = 7000;
}

if (jamkerja > 40)
{
jamtidaklembur = 40;
jamlembur = jamkerja - 40;
}
else
{
jamtidaklembur = jamkerja;
jamlembur = 0;
}
gaji = (honorperjam * jamtidaklembur) + (jamlembur * honorlembur );





System.out.println ("==============================================================================");
System.out.println ();
System.out.println ("Nama = " + nama);
System.out.println ("Gol = " + selection);
System.out.println ("Total jam kerja = " + jamkerja + " jam");
System.out.println ("Total jam lembur = " + jamlembur + " jam");
System.out.println ("Honor per jam = Rp " + honorperjam);
System.out.println ("Honor lembur per jam = Rp " + honorlembur);
System.out.println ("Total honor kerja = " + jamtidaklembur + " x " + "Rp " + honorperjam + " = Rp " + (jamtidaklembur * honorperjam));
System.out.println ("Total honor lembur = " + jamlembur + " x " + "Rp " + honorlembur + " = Rp " + (jamlembur * honorlembur));
System.out.println ();
System.out.println ("------------------------------------------------------------------------------");
System.out.println ("Total Gaji : RP " + gaji);
System.out.println ("------------------------------------------------------------------------------");
System.out.println ();
System.out.println ("Honor Lembur hanya didapat bila telah bekerja lebih dari 40 jam dalam seminggu");
System.out.println ("==============================================================================");
}
}

OUTPUT








1 comment:

  1. http://muh-fahri.blogspot.com/2012/03/listing-v-behaviorurldefaultvml-o.html?showComment=1332442239094#c5669090799580585690

    ReplyDelete