Laman

Rabu, 11 April 2012

Membuat Program cara Menghitung Gaji dengan JAVA [array]

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package gajiarray;

/**
 *
 * @author Administrator
 */
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        BufferedReader dee = new BufferedReader (new InputStreamReader (System.in));
        String Nm = "Dian Septina Sari";
        String nobp = "1010192";

        System.out.println("Nama   : "+Nm);
        System.out.println("No.BP  : "+nobp);

        System.out.println("\n");
        System.out.println("                                  * * * INPUT DATA GAJI KARYAWAN * * *");

        //input data
        String per ="";
        String jml = "";
       
       

            
        System.out.print(" Periode     : ");
        try{
            per= dee.readLine();
        } catch (Exception e) {
            System.out.println("ERROR");}

        System.out.print(" Jumlah Data : ");
        try{
            jml= dee.readLine();
        } catch (Exception e) {
            System.out.println("ERROR");}

        int j = Integer.valueOf(jml).intValue();

        String nk[]=new String [j];
        String gj[]=new String [j];
        double tj []=new double[j];

        double totga[]= new double [j];
        double totsel=0;

        for (int i =0;i<j;i++)
        {
        System.out.print(" Nama Karyawan : ");
        try{
            nk[i]= dee.readLine();
        } catch (Exception e) {
            System.out.print("ERROR");}

        System.out.print(" Gaji Pokok    : ");
        try{
            gj[i]= dee.readLine();
        } catch (Exception e) {
            System.out.println("ERROR");}


      double gaji = Double.valueOf(gj[i]).doubleValue();
   


      tj[i] = 0.10 * gaji;
      totga[i]= tj[i]+gaji;
      totsel = totsel +totga[i];

        }


       System.out.println("\n");
       System.out.println("                          # # # AIM - AMIK - STMIK JAYANUSA # # #");
       System.out.println("____________________________________________________________________________________________\n");
       System.out.println("Periode : "       +per);
       System.out.println("____________________________________________________________________________________________\n");


      
       System.out.println("NO. \t  NAMA \t  Gaji Pokok  \t Tunjangan   \t Total Gaji   ");
       System.out.println("____________________________________________________________________________________________\n");

       for(int d=0;d<j;d++)
       {

       System.out.println((d+1) + "\t"+ nk[d] +"\t\t"+  gj[d] +"\t\t"+  tj[d] +"\t\t"+ totga[d] );

       }

     
      
       System.out.println("_____________________________________________________________________________________________");
       System.out.println("Total Seluruh nya  :                                                            "+totsel);
    }

}

Tidak ada komentar:

Posting Komentar