Minggu, 03 Juli 2011

QUIZ KAMIS SAYA

SOAL : 3
TAMPILAN PROGRAM:
Uses crt;
Type Karyawan = Record
Kode : String[5];
Jabatan : String [15];
Status : String [10];
end;
Var
fkar : file of karyawan;
rkar : karyawan;
lg : Char ;
i,j,pil : Integer;
Gaji : Longint;
Tunjangan : Real;
Tkeluarga : Real;
Total : Real;
procedure openkaryawan;
Begin
Assign (fkar,'c:\karyawan.dat');
{$I-} Reset (fkar);
{$I+} if IOresult <>0 then Rewrite (fkar);
End;
Procedure Menu;
begin
clrscr;
clrscr;
gotoxy (10,5);write ('MENU UTAMA');
gotoxy (10,6);write ('-----------------------------');
gotoxy (10,7);write ('[1].Input Laporan Gaji Karyawan');
gotoxy (10,8);write ('[2].Output karyawan');
gotoxy (10,9);write ('[3].Keluar karyawan');
gotoxy (10,10);write ('------------------------------');
gotoxy (10,11);write ('pilihan:');readln (Pil);
end;

Procedure Inputkaryawan;
begin
clrscr;
openkaryawan;
repeat
gotoxy (30,5);write ('input Karyawan');
gotoxy (30,6);write ('-----------------');
gotoxy (30,7);write ('Kode');readln (rkar.kode);
gotoxy (30,8);write ('Status');readln (rkar.Status);
gotoxy (30,9);write ('------------------------------');
gotoxy (30,10);write ('Input Lagi [Y/T]:');Readln (lg);
Seek (fkar, filesize (fkar));
write (fkar,rkar);clrscr;
Until Upcase (lg)=('T');
end;
procedure outputkaryawan;
Begin
clrscr;
i:=1 ; openkaryawan;
gotoxy (3,1);write ('Laporan Gaji Karyawan');
gotoxy (3,2);write ('--------------------------------------');
gotoxy (3,3);write ('No Kode Jabatan Tunjangan ');
gotoxy (3,4);write ('--------------------------------------');
Seek (fkar,0);
while not Eof(fkar) do
Begin
Seek (fkar,i-1); read (fkar,rkar);
if rkar.Kode='K001' then
begin
rkar.Jabatan:='Supervriser'; Gaji:= 3000000
end
Else if rkar.Kode='K002' then
begin
rkar.Jabatan:='Sekretaris'; Gaji:= 2500000
end
Else if rkar.Kode='K003' then
begin
rkar.Jabatan:='Bendahara'; Gaji:= 2000000
end
Else if rkar.Kode='K004' then
begin
rkar.Jabatan:='Sales'; Gaji:= 1500000;

gotoxy (3,4+i);write(i:2,' ',rkar.kode,' ',rkar.Jabatan);
gotoxy (20,4+i);write(Gaji:8);

if Gaji= 3000000 then Tunjangan:= 0.35 * 3000000
else if Gaji= 2500000 then Tunjangan:= 0.20 * 2500000
else if Gaji= 2000000 then Tunjangan:= 0.10 * 2000000
else Tunjangan:= 0.5 * 1500000;

gotoxy (30,4+i);write(Tunjangan:9);
if rkar.Status='Menikah' Then
begin
TKeluarga:= 0.15 * Gaji ;
end
else if rkar.Status='Belum Menikah' then
begin
Tkeluarga:=0;
Total:= Gaji + Tunjangan + Tkeluarga;
gotoxy (40,4+i);write (Total:10:0);
inc (i);
end;
READLN;
end;
begin
pil:=0;
while pil <>3 do
begin
menu;
case pil of
1 : Inputkaryawan;
2 : outputkaryawan;
end;
end;
close (fkar);
end.

SOAL: 4
TAMPILAN PROGRAM:
Uses crt;
var

Kode : Array [1..10] of String[3];
Nama : Array [1..10] of String[40];
Pendidikan : Array [1..10] of String [15];
Keahlian : Array [1..10] of String [30];
i,pil : Byte;
Lg : Char;
Npm : Array [1..10] of String[8];
Jenjang : Array [1..10] of String [30];
Jurusan : Array [1..10] of String [20];
Tahun : Longint;
Procedure openDosen;
begin
Assign (fdos,'c:\Doden.dat');
{$I-} Reset (fdos);
{$I+} if IOresult <>0 then Rewrite (fdos);
end;

Procedure Menu;
begin
clrscr;
clrscr;
gotoxy (10,5);write ('MENU UTAMA');
gotoxy (10,6);write ('-----------------------------');
gotoxy (10,7);write ('[1].Input Data Dosen');
gotoxy (10,8);write ('[2].Input Data Mahasiswa');
gotoxy (10,9);write ('[3].Output Data Dosen');
gotoxy (10,10);write ('[4].Output Data Mahasiswa');
gotoxy (10,11);write ('[5].Keluar program');
gotoxy (10,12);write ('------------------------------');
gotoxy (10,13);write ('pilihan:');Readln (pil);
end;

Procedure InputDosen;
Begin
Opendosen;
clrscr;
repeat
gotoxy (30,5);write ('input Data Dosen');
gotoxy (30,6);write ('------------------------------------------');
gotoxy (30,7);write ('Kode Dosen :');
gotoxy (30,8);write ('Nama :');
gotoxy (30,9);write ('Pendidikan :');
gotoxy (30,10);write ('keahlian :');
gotoxy (30,11);write ('------------------------------------------');
gotoxy (30,12);write ('Input Data Lagi [Y/T]:');
Seek (fdos, filesize (fdos));
write (fdos,rdos);clrscr;
Until Upcase (lg)= ('T');

end;

procedure outputDosen;
Begin
clrscr;
gotoxy (3,1);write ('Informasi Data Dosen');
gotoxy (3,2);write ('------------------------------------------------------');
gotoxy (3,3);write ('No Kode Nama Pendidikan Keahlian ');
gotoxy (3,4);write ('------------------------------------------------------');
Seek (fdos,0);
while not Eof (fdos) do
end;


Procedure InputMahasiswa;
begin
clrscr;
gotoxy (50,5);write ('input Data Mahasiswa');
gotoxy (50,6);write ('------------------------------------------');
gotoxy (50,7);write ('Nama :');
gotoxy (50,8);write ('Jenjang :');
gotoxy (50,9);write ('Jurusan :');
gotoxy (50,10);write ('Tahun :');
gotoxy (50,11);write ('------------------------------------------');
gotoxy (50,12);write ('Input Data Lagi [Y/T]:');
end;

procedure outputMahasiswa;
Begin
clrscr;

gotoxy (5,1);write ('Informasi Data Mahasiswa');
gotoxy (5,2);write ('---------------------------------------------------------');
gotoxy (5,3);write ('No NPm Nama Jenjang Jurusan Tahun ');
gotoxy (5,4);write ('---------------------------------------------------------');
end;
begin
i:=1;pil:=1;
while pil <> 5 do
begin
menu;
case pil of
1 : InputDosen;
2 : inputMahasiswa;
3 : outputDosen;
4 : OutputMahasiswa;
end;
end;
End.
OUTPUT:
OUTPUT:









OUTPUT:

Tidak ada komentar:

Posting Komentar