import java.util.Scanner;
import java.io.*;
public class penggajian
{
String Nama ;
int Gapok;
int
tunjangan_anak;
int gaji;
}
//sub kelas ke pertama
class Karyawan extends penggajian
{
Scanner
inputan= new Scanner(System.in);
public void
inputKaryawan()
{
Karyawan obj =
new Karyawan();
obj.inputKaryawan();
}
}
//sub kelas ke dua
class Staff extends penggajian
{
Scanner
inputan= new Scanner(System.in);
public void
inputStaff()
{
Staff obj1= new
Staff();
obj1.inputStaff();
}
}
//sub kelas ke ketiga
class Supervisior extends penggajian
{
Scanner
inputan= new Scanner(System.in);
public void
inputSupervisior()
{
Supervisior
obj2= new Supervisior();
obj2.inputSupervisior();
}
}
//sub kelas ke keempat
class Manajer extends penggajian
{
Scanner
inputan= new Scanner(System.in);
public void
inputManajer()
{
Manajer obj3=
new Manajer();
obj3.inputManajer();
}
}
//method main;
class demoPenggajian
{
public
static void main(String[]args)
{
Scanner
sc= new Scanner(System.in);
System.out.println("Struktur
Penggajian ");
System.out.println("1.
Karyawan");
System.out.println("2.
Staff");
System.out.println("3.
Supervisior");
System.out.println("4.
Manajer");
System.out.print("Pilihan
anda = ");
System.out.print("Masukan pilihan golongan : ");
int pilih =
sc.nextInt();
int
tunjangan_anak =0;
if
(pilih==1)
{
System.out.println("");
System.out.println("---------------------");
System.out.println("
Karyawan ");
System.out.println("---------------------");
System.out.print("Masukan Nama : ");
char nama = sc.next().charAt(0);
System.out.print("Masukan NIP:
");
int NIP = sc.nextInt();
System.out.print("Jumlah Hadir:
");
int JH = sc.nextInt();
int gaji= JH*50000;
System.out.print("Tunjangan Anak:
");
int TA = sc.nextInt();
if (TA<=2)
{
tunjangan_anak=1000000;
}
else if(TA>=2)
{
tunjangan_anak=1200000;
}
System.out.print("Gaji Pokok = "+
gaji );
}
else if
(pilih==2)
{
System.out.println("");
System.out.println("---------------------");
System.out.println("
Staff ");
System.out.println("---------------------");
System.out.print("Masukan Nama : ");
char nama = sc.next().charAt(0);
System.out.print("Masukan NIP:
");
int NIP = sc.nextInt();
System.out.print("Jumlah Hadir:
");
int JH = sc.nextInt();
int gaji= JH*150000;
System.out.print("Tunjangan Anak:
");
int TA = sc.nextInt();
if (TA<=2)
{
tunjangan_anak=1000000;
}
else if(TA>=2)
{
tunjangan_anak=1200000;
}
System.out.print("Gaji Pokok = "+
gaji );
}
else if
(pilih==3)
{
System.out.println("");
System.out.println("---------------------");
System.out.println("
Supervisior ");
System.out.println("---------------------");
System.out.print("\nMasukan Nama : ");
char nama = sc.next().charAt(0);
System.out.print("Masukan NIP:
");
int NIP = sc.nextInt();
System.out.print("Jumlah Hadir:
");
int JH = sc.nextInt();
int gaji= JH*200000;
System.out.print("Tunjangan Anak:
");
int TA = sc.nextInt();
if (TA<=2)
{
tunjangan_anak=1000000;
}
else if(TA>=2)
{
tunjangan_anak=1200000;
}
System.out.print("Gaji Pokok = "+
gaji );
}
else if
(pilih==4)
{
System.out.println("");
System.out.println("---------------------");
System.out.println(" Manager ");
System.out.println("---------------------");
System.out.print("\nMasukan Nama :
");
char nama = sc.next().charAt(0);
System.out.print("Masukan NIP:
");
int NIP = sc.nextInt();
System.out.print("Jumlah Hadir:
");
int JH = sc.nextInt();
int gaji= JH*350000;
System.out.print("Tunjangan Anak:
");
int TA = sc.nextInt();
if (TA<=2)
{
tunjangan_anak=1000000;
}
else if(TA>=2)
{
tunjangan_anak=1200000;
}
System.out.print("Gaji Pokok = "+
gaji );
}
System.out.println("");
System.out.println("Tunjangan
anak = " + tunjangan_anak);
}
}
Download script Link1 / Link2
No comments:
Post a Comment