Script Source Code
Aplikasi Penggajian Karyawan Borland C++
Struktur Data
#include<iostream>
#include<conio.h>
#include<stdio.h>
#include<cstring>
#define pkerja 30
#define in 9
#define out 9
string nm[pkerja];
int pnd[pkerja];
string pendidikan[pkerja];
int data[pkerja][in];
int hasil[pkerja][out];
int jum;
int anak,tk;
int tgl,th,i;
char bln[12],sm,lagi,y;
void menu()
{
int kode;
MENU :
{
printf("\t================================================================\n");
printf("\t| APLIKASI PENGGAJIAN KARYAWAN |\n");
printf("\t| PT. WARNA WARNI |\n");
printf("\t================================================================\n");
printf("\n");
cout <<"\t\t\t ______________________________"<<endl;
cout <<"\t\t\t | Menu Utama : |\n";
cout <<"\t\t\t | 1. Atur Tanggal Penggajian |\n";
cout <<"\t\t\t | 2. Entri Data |\n";
cout <<"\t\t\t | 3. List Data |\n";
cout <<"\t\t\t | 4. Exit |\n";
cout <<"\t\t\t |_____________________________|\n";
cout <<"\n";
}
cout<<"MENU YANG DIPILIH? 1-4 ? : ";cin>>kode;
clrscr();
//fungsi if untuk masuk dalam program yang di pilih dari menu//
if (kode==1)
{
goto TANGGAL;
}
if (kode==2)
{
goto INPUT;
}
if (kode==3)
{
goto OUTPUT;
}
if (kode==4)
{
goto BIODATA;
}
getch();
TANGGAL:
{
cout <<" ______________________________________"<<endl;
cout <<" Masukan Waktu Penggajian !!! \n";
cout <<" Tanggal : ";cin>>tgl;
cout <<" Bulan : ";cin>>bln;
cout <<" Tahun : ";cin>>th;
cout <<" ______________________________________"<<endl;
cout <<"\nTekan ENTER untuk kembali ke menu !!!";
}
getch ();
{
clrscr();
goto MENU;
}
INPUT:
{
clrscr();
int j;
cout <<"\n";
cout <<" Jumlah Karyawan : ";cin>>jum;
cout <<"\n";
for(int i=0;i<jum;i++)
{
j=i+1;
cout <<" ___________________________________________"<<endl;
cout <<" Nama : ";cin>>nm[j];
cout <<" Pendidikan";
cout <<"\n 1=S2 2=S1 3=D3";
cout <<"\n 4=smk/sma 5=<SMA : ";cin>>pnd[j];
cout <<" Lama kerja(tahun) : ";cin>>data[j][1];
cout <<" Jumlah masuk kerja : ";cin>>data[j][2];
cout <<" Status Menikah (Y/T): ";cin>>sm;
if ((sm=='Y')||(sm=='y'))
{
data[j][3]=1;
cout <<" Jumlah Anak : ";cin>>data[j][4];
cout <<" ___________________________________________"<<endl;
}
else
{
data[j][3]=0;
data[j][4]=0;
}
}
cout <<"\nTekan ENTER untuk kembali ke menu !!!";
}
getch ();
{
//clrscr();
goto MENU;
}
OUTPUT:
{
cout <<"\nList gaji karyawan PT. WARNA WARNI\n";
cout<<"Tanggal :"<<tgl<<" "<<bln<<" "<<th<<endl;
cout<<"+---------+---------+---------+---------+---------+---------+---------+--------+\n";
gotoxy(1,5);cout<<"| Nama";
gotoxy(11,5);cout<<"|experience";
gotoxy(21,5);cout<<"|Pendidikan";
gotoxy(31,5);cout<<"| Gapok";
gotoxy(41,5);cout<<"| T.Kerja";
gotoxy(51,5);cout<<"| T.Trans";
gotoxy(61,5);cout<<"| T.Kel";
gotoxy(71,5);cout<<"| Total |";
cout<<"+---------+---------+---------+---------+---------+---------+---------+--------+\n";
int s;
for (int v=0;v<jum;v++)
{
s=v+1;
if(pnd[1]==1)
{
pendidikan[s]="S2";
hasil[s][1]=3000000;
if(data[s][1]>5)
{hasil[s][2]=700000;}
else if(data[s][1]>3)
{hasil[s][2]=500000;}
else if(data[s][1]>1)
{hasil[s][2]=400000;}
else
{hasil[s][2]=0;}
}
else if(pnd[1]==2)
{
pendidikan[s]="S1";
hasil[s][1]=2500000;
if(data[s][1]>5)
{hasil[s][2]=500000;}
else if(data[s][1]>3)
{hasil[s][2]=300000;}
else if(data[s][1]>1)
{hasil[s][2]=200000;}
else
{hasil[s][2]=0;}
}
else if(pnd[1]==3)
{
pendidikan[s]="D3";
hasil[s][1]=2000000;
if(data[s][1]>5)
{hasil[s][2]=400000;}
else if(data[s][1]>3)
{hasil[s][2]=200000;}
else if(data[s][1]>1)
{hasil[s][2]=100000;}
else
{hasil[s][2]=0;}
}
else if(pnd[1]==4)
{
pendidikan[s]="SMA/SMK";
hasil[s][1]=1500000;
hasil[s][2]=0;
}
else if(pnd[1]==5)
{
pendidikan[s]="<SMA/SMK";
hasil[s][1]=1000000;
hasil[s][2]=0;
}
hasil[s][3]=data[s][2]*10000;
if(data[s][3]==1)
{
tk=150000;
}
else
{tk=0;}
if(data[s][4]<=3)
{
anak=(data[s][4]*150000);
}
else
{
anak=(3*150000);
}
hasil[s][4]=tk+anak;
hasil[s][5]=hasil[s][1]+hasil[s][2]+hasil[s][3]+hasil[s][4];
gotoxy(1,6+s);cout<<"|"<<nm[s];
gotoxy(11,6+s);cout<<"|"<<data[s][1]<<" Tahun";
gotoxy(21,6+s);cout<<"|"<<pendidikan[s]; //status pendidikan
gotoxy(31,6+s);cout<<"|"<<hasil[s][1]; //hasil hitung gaji
gotoxy(41,6+s);cout<<"|"<<hasil[s][2]; //hasil hitung Tunjangan Kerja
gotoxy(51,6+s);cout<<"|"<<hasil[s][3]; //hasil Hitung Tunjangan Transportasi
gotoxy(61,6+s);cout<<"|"<<hasil[s][4]; //hasil Hitung Tunjangan Keluarga
gotoxy(71,6+s);cout<<"|"<<hasil[s][5];cout<<" |";
gotoxy(1,7+jum);cout<<"+---------+---------+---------+---------+---------+---------+---------+--------+\n";
}
}
getch ();
{
clrscr();
goto MENU;
}
BIODATA:
{
printf("\t================================================================\n");
printf("\t| UTS STRUKTUR DATA |\n");
printf("\t| Nama : Ayu Erlina |\n");
printf("\t| NIM : B15042 |\n");
printf("\t| Prodi : Manajemen Informatika B |\n");
printf("\t================================================================\n");
getch();
}
}
void main()
{
clrscr();
menu();
}
Semoga Bermanfaat Guys
Data Pribadi/Manajemen Informatika/ Struktur Data
0 Komentar