Program Hitung Nilai Akhir
/**Latihan Bab7 no2**/
/* Created by: Ipah Hanifah */
# include <stdio.h># include <conio.h>
# include <iostream.h>
main()
{
int a,j,tgs[4],uas[4],uts[4],ahr[4];
char nama[4][10],g[4];
clrscr();
cout<<"Masukkan Jumlah Mahasiswa : ";cin>>j;
cout<<"================================"<< endl ;
for (a=1;a<=j;a++)
{
cout<<"Mahasiswa ke - "<< a << endl ;
cout<<"Nama Mahasiswa : ";gets(nama[a]);
cout<<"Nilai Tugas : ";cin>>tgs[a];
cout<<"Nilai UTS : ";cin>>uts[a];
cout<<"Nilai UAS : ";cin>>uas[a];
}
clrscr();
cout<<"\t Daftar Nilai"<< endl ;
cout<<"\t Materi : Pemrograman C++"<< endl ;
cout<<"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="<< endl ;
cout<<"No. Nama Nilai Grade "<< endl ;
cout<<" Mahasiswa ------------------------------------- "<< endl ;
cout<<" Tugas UAS UTS Akhir "<< endl ;
cout<<"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="<< endl ;
for (a=1;a<=j;a++)
{
cout<< a ;
gotoxy(5,7+a);cout<<nama [a];
gotoxy(15,7+a);cout<<tgs [a];
gotoxy(25,7+a);cout<<uas [a];
gotoxy(32,7+a);cout<<uts [a];
ahr[a]=(tgs[a]*0.3)+(uts[a]*0.3)+(uas[a]*0.4);
if (ahr[a]>=80)
g[a]='A';
else if (ahr[a]>=70)
g[a]='B';
else if (ahr[a]>=59)
g[a]='C';
else if (ahr[a]>=50)
g[a]='D';
else if (ahr[a]<50)
g[a]='E';
else
g[a]=0;
gotoxy(39,7+a);cout<<ahr [a];
gotoxy(47,7+a);cout<<g [a]<<endl;
}
cout<<"=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="<< endl ;
getch();
}
Output:
__________________________________________________
Program Hitung Honor Karyawan PT. STAY COOL
/**Latihan Bab7 no3**/
/** Created by: Ipah Hanifah **/
# include <stdio.h>
# include <conio.h>
# include <iostream.h>
# include <iomanip.h>
main()
{
int i, n,gol[5],pen[5];
float jjk[5];
char nk[5][20];
double golongan[5],pend[5],a[5],juml[5],pendapatan[5],gaji[5];
long total=0;
clrscr();
cout<<" ====================================================="<<endl;
cout<<" Program Hitung Honor Karyawan Kontrak PT.STAY COOL\n";
cout<<" ====================================================="<<endl<<endl;
cout<<"Banyak karyawan : ";cin>>n;
for (i=1;i<=n;i++)
{
cout<<"\nkaryawan Ke - "<<i<<endl;
cout<<" Nama Karyawan : ";cin>>nk[i];
cout<<" Golongan : ";cin>>gol[i];
cout<<" Pendidikan (1.SMU 2.D3 3.S1): ";cin>>pen[i];
cout<<" Jumlah Jam Kerja : ";cin>>jjk[i];
gaji[i]=700000;
if(gol[i]==1)
golongan[i]=0.05*gaji[i];
else if(gol[i]==2)
golongan[i]=0.1*gaji[i];
else
golongan[i]=0.15*gaji[i];
if(pen[i]==1)
pend[i]=0.025*gaji[i];
else if(pen[i]==1)
pend[i]=0.05*gaji[i];
else
pend[i]=0.075*gaji[i];
if(jjk[i]>=8)
{
a[i]=jjk[i]-8;
juml[i]=a[i]*2500;
}
else
{
juml[i]=0;
}
pendapatan[i]=golongan[i]+pend[i]+juml[i]+gaji[i];
}
clrscr();
cout<<" PT. STAY COOL "<<endl;
cout<<"--------------------------------------------------------"<<endl;
cout<<"No. Nama Tunjangan Honor Pendapatan"<<endl;
cout<<" Karyawan Jabatan Pendidikan Lembur Bersih"<<endl;
cout<<"--------------------------------------------------------"<<endl;
for(i=1;i<=n;i++)
{
cout<<i ;
cout<<"\t" <<nk[i];
cout<<"\t" <<golongan[i];
cout<<"\t " <<pend[i];
cout<<"\t " <<juml[i] ;
cout<<"\t "<<pendapatan[i] <<endl;
total=total+pendapatan[i];
}
cout<<"---------------------------------------------------------"<<endl;
cout<<"Total Gaji yg dikeluarkan Rp. "<<total<<endl;
getche();
}
# include <conio.h>
# include <iostream.h>
# include <iomanip.h>
main()
{
int i, n,gol[5],pen[5];
float jjk[5];
char nk[5][20];
double golongan[5],pend[5],a[5],juml[5],pendapatan[5],gaji[5];
long total=0;
clrscr();
cout<<" ====================================================="<<endl;
cout<<" Program Hitung Honor Karyawan Kontrak PT.STAY COOL\n";
cout<<" ====================================================="<<endl<<endl;
cout<<"Banyak karyawan : ";cin>>n;
for (i=1;i<=n;i++)
{
cout<<"\nkaryawan Ke - "<<i<<endl;
cout<<" Nama Karyawan : ";cin>>nk[i];
cout<<" Golongan : ";cin>>gol[i];
cout<<" Pendidikan (1.SMU 2.D3 3.S1): ";cin>>pen[i];
cout<<" Jumlah Jam Kerja : ";cin>>jjk[i];
gaji[i]=700000;
if(gol[i]==1)
golongan[i]=0.05*gaji[i];
else if(gol[i]==2)
golongan[i]=0.1*gaji[i];
else
golongan[i]=0.15*gaji[i];
if(pen[i]==1)
pend[i]=0.025*gaji[i];
else if(pen[i]==1)
pend[i]=0.05*gaji[i];
else
pend[i]=0.075*gaji[i];
if(jjk[i]>=8)
{
a[i]=jjk[i]-8;
juml[i]=a[i]*2500;
}
else
{
juml[i]=0;
}
pendapatan[i]=golongan[i]+pend[i]+juml[i]+gaji[i];
}
clrscr();
cout<<" PT. STAY COOL "<<endl;
cout<<"--------------------------------------------------------"<<endl;
cout<<"No. Nama Tunjangan Honor Pendapatan"<<endl;
cout<<" Karyawan Jabatan Pendidikan Lembur Bersih"<<endl;
cout<<"--------------------------------------------------------"<<endl;
for(i=1;i<=n;i++)
{
cout<<i ;
cout<<"\t" <<nk[i];
cout<<"\t" <<golongan[i];
cout<<"\t " <<pend[i];
cout<<"\t " <<juml[i] ;
cout<<"\t "<<pendapatan[i] <<endl;
total=total+pendapatan[i];
}
cout<<"---------------------------------------------------------"<<endl;
cout<<"Total Gaji yg dikeluarkan Rp. "<<total<<endl;
getche();
}
Output
No comments:
Post a Comment