// Menghitung Gaji pegawai //
import java.io.*
public class gaji{
public static void main(String[] args){
String namajabatan="";
double gaji=0.0;
try{
BufferedReader x=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukan jumlah data : ");
int n=Integer.parseInt(x.readLine());
String []nama =new String[n];
int []NIP=new int[n];
int []gaji=new int[n];
int []gajibersih=new int[n];
int []tunjangan=new int[n];
int i,total=0;
BufferedReader a=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukan Nama : ");
nama[i]=a.readLine();
BufferedReader b=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Masukan NIP : ");
NIP[i]=Integer.parseInt(a.readLine());
String jabatan = nim.substring(0,1);
String thn_msk = nim.substring (2,5);
if (jabatan.equals("1")){namajabatan ="MANAGER";gaji=2000000;}
else if (jabatan.equals("2")){namajabatan ="ASISTEN MANAGER";gaji=1000000;}
else if (jabatan.equals("3")){namajabatan ="STAFF";gaji=500000;}
else {namajabatan = "Salah Isi";gaji=0;}
if (gaji[i]>=2000000){
tunjangan[i]=gaji[i]/10;
}
gajibersih[i]=gaji[i]+tunjangan[i];
total=total+gajibersih[i];
tunjangan[i]=0;
}
System.out.println();
System.out.println();
System.out.println("No|Nama And|Nomor Induk Pegawai|gaji| tunjangan | Total");
for (i=0;i<n;i++){
System.out.println(++i+" | "+nama[--i]+" | "+NIP[i]+" | "+gaji[i]+" | "+tunjangan[i]+" | "+jumlah2[i]);
}
System.out.println();
System.out.println("Total gaji: "+total);
}
catch (IOException e){
e.printStackTrace();
}
}
}
Categories:
java