- Go green...
- hmm, its golden colour...
- Holy colour, yes it white...
- The Brave Colour is Red only, i think...
- I Think blue is calm colour...
Rabu, 10 Juni 2015
Rabu, 08 April 2015
Coding Menghitung Kelipatan Persekutuan Terkecil (KPK)
uses wincrt;
var
bil1,bil2,b,c,d : integer;
e : real;
begin
writeln;
write('Masukkan Angka Pertama: ');readln(bil1);
write('Masukkan Angka Kedua: ');readln(bil2);
writeln;
b := bil1;
while b >= 1 do
begin
c := bil1 mod b;
d := bil2 mod b;
if (c = 0) and (d = 0) then
begin
e := (bil1 * bil2) / b;
writeln('KPK dari ',bil1,' dan ',bil2,' adalah ',e:0:0);
writeln('__________________________');
writeln('+++DeffBoyy Punyaaa+++');
b := 0;
end;
b := b - 1;
end;
End.
var
bil1,bil2,b,c,d : integer;
e : real;
begin
writeln;
write('Masukkan Angka Pertama: ');readln(bil1);
write('Masukkan Angka Kedua: ');readln(bil2);
writeln;
b := bil1;
while b >= 1 do
begin
c := bil1 mod b;
d := bil2 mod b;
if (c = 0) and (d = 0) then
begin
e := (bil1 * bil2) / b;
writeln('KPK dari ',bil1,' dan ',bil2,' adalah ',e:0:0);
writeln('__________________________');
writeln('+++DeffBoyy Punyaaa+++');
b := 0;
end;
b := b - 1;
end;
End.
Coding Deret huruf
Program deret_huruf;
uses wincrt;
var i,batas:char;
Begin
write('Masukkan huruf a sampai dengan z : ');
readln(batas);
for i:='a' to batas do
write(i,' ');
readln;
End.
uses wincrt;
var i,batas:char;
Begin
write('Masukkan huruf a sampai dengan z : ');
readln(batas);
for i:='a' to batas do
write(i,' ');
readln;
End.
Coding Pendataan Anggota Perpustakaan
Program Kartu_Perpustakaan;
Uses WinCrt;
Type
Mahasiswa = Record
NIM : Word;
Nama : String[15];
JK : Char;
Jenis_Kelamin : String[10];
TTL : String[30];
Alamat : String[25];
Jur : Char;
Jurusan : String[22];
End;
Var
FileMhs : File of Mahasiswa;
Data : Mahasiswa;
Pil,Pilihan,Ul : Char;
Procedure Menu_Utama;
Begin
Screensize.X := 168;
Screensize.Y := 45;
Clrscr;
Gotoxy(36,4) ;Write('======================================================================================================');
Gotoxy(59,5) ;Write('APLIKASI DATA PERPUSTAKAAN KAMPUS STMIK PALANGKARAYA ');
Gotoxy(36,6) ;Write('======================================================================================================');
Gotoxy(36,8) ;Write('MENU DATA ANGGOTA');
Gotoxy(36,9) ;Write('=========================');
Gotoxy(36,11);Write('A. Tambah Data Anggota');
Gotoxy(36,13);Write('B. Edit Data Anggota');
Gotoxy(36,15);Write('C. Hapus Data Anggota');
Gotoxy(36,17);Write('D. Tampilkan Data Anggota');
Gotoxy(36,19);Write('E. Pencarian ');
Gotoxy(76,8) ;Write('MENU DATA BUKU');
Gotoxy(76,9) ;Write('======================');
Gotoxy(76,11);Write('F. Tambah Data Buku');
Gotoxy(76,13);Write('G. Edit Data Buku');
Gotoxy(76,15);Write('H. Hapus Data Buku');
Gotoxy(76,17);Write('I. Tampilkan Data Buku');
Gotoxy(111,8) ;Write('MENU DATA PEMBELIAN BUKU ');
Gotoxy(111,9) ;Write('========================');
Gotoxy(111,11);Write('J. Tambah Data Transaksi');
Gotoxy(111,13);Write('K. Edit Data Transaksi');
Gotoxy(111,15);Write('L. Hapus Data Transaksi');
Gotoxy(111,17);Write('M. Tampilkan Data Transaksi');
Gotoxy(36,21);Write('======================================================================================================');
Gotoxy(50,23);Write('MENU DATA PEMINJAMAN BUKU ');
Gotoxy(50,24);Write('============================');
Gotoxy(50,26);Write('N. Tambah Data Peminjaman');
Gotoxy(50,28);Write('O. Edit Data Peminjaman');
Gotoxy(50,30);Write('P. Hapus Data Peminjaman');
Gotoxy(50,32);Write('Q. Tampilkan Data Peminjaman');
Gotoxy(98,23);Write('MENU DATA PENGEMBALIAN BUKU ');
Gotoxy(98,24);Write('==============================');
Gotoxy(98,26);Write('R. Tambah Data Pengembalian');
Gotoxy(98,28);Write('S. Edit Data Pengembalian');
Gotoxy(98,30);Write('T. Hapus Data Pengembalian');
Gotoxy(98,32);Write('U. Tampilkan Data Pengembalian');
Gotoxy(36,35);Write('======================================================================================================');
Gotoxy(81,36);Write('W. Bantuan (?) ');
Gotoxy(75,38);Write('Y. Tentang Aplikasi Ini (i) ');
Gotoxy(80,40);Write('X. Keluar (Exit)');
Gotoxy(36,41);Write('======================================================================================================');
Gotoxy(75,43);Write('Masukkan Pilihan Anda [A..X]: ');Pil:=Readkey;
End;
{Procedure Untuk Menangani Data Anggota Perpustakaan}
Procedure BukaFile;
Begin
Assign(FileMhs,'Mhs.Dat');
{$I-};
Reset(FileMhs);
{$I+};
End;
Procedure Tambah_Data_Anggota;
Var
Lagi : Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
Rewrite(FileMhs);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(55,4);Write('TAMBAH DATA ANGGOTA');
Gotoxy(55,5);Write('===================');
Gotoxy(53,7);Write('NIM : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileMhs)) Do
Begin
Seek(FileMhs,i);
Read(FileMhs,Data);
If Data.NIM=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(49,15);Write('NIM Anggota "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileMhs,Filesize(FileMhs));
Data.NIM:=NOCR;
Gotoxy(53,9);Write('Nama Anggota : ');Readln(Data.Nama);
Gotoxy(53,11);Write('Jenis Kelamin (L:Laki-laki dan P : Perempuan):');Readln(Data.JK);
If (Data.JK = 'L') or (Data.JK='l') then
Data.Jenis_Kelamin:='Laki-laki'
Else
If (Data.JK='P') or (Data.JK='p') then
Data.Jenis_Kelamin:='Perempuan'
Else
Data.Jenis_Kelamin:='Tidak Ada';
Gotoxy(53,13) ;Write('Jenis Kelamin Anda : ', Data.Jenis_Kelamin);
Gotoxy(53,15);Write('TTL : ');Readln(Data.TTL);
Gotoxy(53,17);Write('Alamat : ');Readln(Data.Alamat);
Gotoxy(53,19);Write('Jurusan : ');Readln(Data.Jur);
If(Data.Jur='M')or(Data.Jur='m') then
Data.Jurusan:='Manajemen Informartika'
Else
If(Data.Jur='S')or(Data.Jur='s')then
Data.Jurusan:='Sistem Informasi'
Else
If(Data.Jur='T')or(Data.Jur='t')then
Data.Jurusan:='Teknik Informatika'
Else
Data.Jurusan:='Tidak Ada';
Gotoxy(53,21);Write('Jurusan Anda:',Data.Jurusan);
Write(FileMhs,Data);
End;
Gotoxy(20,26);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileMhs);
End;
Procedure Edit_Data_Anggota;
Var
Lagi : Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
Write('Data Masih Kosong....!!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(55,4);Write('EDIT DATA ANGGOTA');
Gotoxy(55,5);Write('=================');
Gotoxy(55,7);Write('NIM : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileMhs)) Do
Begin
Seek(FileMhs,i);
Read(FileMhs,Data);
If Data.NIM=NOCR Then
Begin
Ada:=True;
Gotoxy(55,9) ;Write('Nama Anggota : ',Data.Nama);
Gotoxy(55,11);Write('Jenis Kelamin : ',Data.Jenis_Kelamin);
Gotoxy(55,13);Write('TTL : ',Data.TTL);
Gotoxy(55,15);Write('Alamat : ',Data.Alamat);
Gotoxy(55,17);Write('Jurusan : ',Data.Jurusan);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Data.NIM:=NOCR;
Gotoxy(55,23);Write('Nama Anggota : ');Readln(Data.Nama);
Gotoxy(55,25);Write('Jenis Kelamin (L:Laki-laki dan P : Perempuan):');Readln(Data.JK);
If (Data.JK = 'L') or (Data.JK='l') then
Data.Jenis_Kelamin:='Laki-laki'
Else
If (Data.JK='P') or (Data.JK='p') then
Data.Jenis_Kelamin:='Perempuan'
Else
Data.Jenis_Kelamin:='Tidak Ada';
Gotoxy(55,27);Write('Jenis Kelamin Anda : ', Data.Jenis_Kelamin);
Gotoxy(55,29);Write('TTL : ');Readln(Data.TTL);
Gotoxy(55,31);Write('Alamat : ');Readln(Data.Alamat);
Gotoxy(55,35);Write('Jurusan : ');Readln(Data.Jur);
If(Data.Jur='M')or(Data.JK='m') then
Data.Jurusan:='Manajemen Informartika'
Else
If(Data.Jur='S')or(Data.Jur='s')then
Data.Jurusan:='Sistem Informasi'
Else
If(Data.Jur='T')or(Data.Jur='t')then
Data.Jurusan:='Teknik Informatika'
Else
Data.Jurusan:='Tidak Ada';
Gotoxy(55,36);Write('Jurusan Anda : ', Data.Jurusan);
Seek(FileMhs,i);
Write(FileMhs,Data);
End
Else
Begin
Gotoxy(55,15);Write('NIM Anggota "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(55,38);Write('Mau Edit Data Lagi ? [Y/T] : ');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(Filemhs);
End;
Procedure Hapus_Data_Anggota;
Var
FileTmp : File of Mahasiswa;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFile;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'mhs.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(55,4);Write('HAPUS DATA ANGGOTA');
Gotoxy(55,5);Write('==================');
Gotoxy(52,7);Write('NIM : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileMhs)) Do
Begin
Seek(FileMhs,i);
Read(FileMhs,Data);
If Data.NIM=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(52,9) ;Write('Nama Anggota : ',Data.Nama);
Gotoxy(52,11);Write('Jenis Kelamin : ',Data.Jenis_Kelamin);
Gotoxy(52,13);Write('TTL : ',Data.TTL);
Gotoxy(52,15);Write('Alamat : ',Data.Alamat);
Gotoxy(52,19);Write('Jurusan : ',Data.Jurusan);
Gotoxy(52,22);Write('Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileMhs) Do
Begin
Seek(FileMhs,i-1);
Read(FileMhs,Data);
If Data.NIM<>NOCR Then
Write(FileTmp,Data);
End;
Close(FileMhs);
Assign(FileMhs,'MHS.Dat');
Erase(FileMhs);
Assign(FileTmp,'Mhs.tmp');
Rename(FileTmp,'Mhs.Dat');
Gotoxy(52,24);Write('NIM "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(52,19);Write('NIM "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(52,26);Write('Mau Hapus Data Lagi [Y/T] : ');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Anggota;
Var
i:Integer;
Begin
Ul:='Y';
BukaFile;
If IoResult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Clrscr;
Writeln;
Writeln;
Writeln(' =========================');
Writeln(' DATA ANGGOTA PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln(' =========================');
Writeln;
Writeln(' Masa Berlaku s/d : 2020');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO NIM NAMA JENIS TEMPAT/ ALAMAT JURUSAN');
Writeln(' ANGGOTA KELAMIN TANGGAL LAHIR ANGGOTA ');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileMhs) Do
Begin
Inc(i);
Read(FileMhs,Data);
Writeln(i:2,Data.NIM:7,Data.Nama:15,Data.Jenis_Kelamin:17,Data.TTL:26,Data.Alamat:22,Data.Jurusan:25);
End;
Writeln('==================================================================================================================');
Close(FileMhs);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Pencarian Nama Anggota}
Procedure Cari_Nama_Anggota;
Var
i : Integer;
NA : String[10];
Lagi : Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat
Clrscr;
Writeln;
Writeln;
Write(' Cari Nama Anggota : ');Readln(NA);
BukaFile;
If IoResult <> 0 Then
Write('Maaf Data Masih Kosong ! ')
Else
Begin
Clrscr;
Writeln;
Writeln;
Writeln(' =========================');
Writeln(' DATA ANGGOTA PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln(' =========================');
Writeln;
Writeln(' Masa Berlaku s/d : 2020');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO NIM NAMA JENIS TEMPAT/ ALAMAT JURUSAN');
Writeln(' ANGGOTA KELAMIN TANGGAL LAHIR ANGGOTA ');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileMhs) Do
Begin
Read(FileMhs,Data);
If Data.Nama=NA Then
Begin
Inc(i);
Writeln(i:2,Data.NIM:7,Data.Nama:15,Data.Jenis_Kelamin:17,Data.TTL:26,Data.Alamat:22,Data.Jurusan:25);
End;
End;
Writeln('==================================================================================================================');
Close(FileMhs);
End;
Writeln;
Write('Mau Lihat Data Lagi [Y/T]: ');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
{Procedure Untuk Menangani Data Buku Perpustakaan}
Type
Buku = Record
ID : Word;
JudulBk : String [30];
Pengarang : String [30];
Penerbit : String [30];
End;
Var
FileBk : File Of Buku;
DataBk : Buku;
Pilih,Pilihannya,Ulang : Char;
Procedure BukaFileBk;
Begin
Assign(FileBk,'Bk.Dat');
{$I-};
Reset(FileBk);
{$I+};
End;
Procedure Tambah_Data_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBk;
If IOResult<>0 Then
Rewrite(FileBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,5);Write('TAMBAH DATA BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,9);Write('ID : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBk)) Do
Begin
Seek(FileBk,i);
Read(FileBk,DataBk);
If DataBk.ID=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,13);Write('ID "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileBk,Filesize(FileBk));
DataBk.ID:=NOCR;
Gotoxy(20,11); Write('Judul Buku : ');Readln(DataBk.JudulBk);
Gotoxy(20,13);Write('Pengarang : ');Readln(DataBk.Pengarang);
Gotoxy(20,15);Write('Penerbit : ');Readln(DataBk.Penerbit);
Write(FileBk,DataBk);
End;
Gotoxy(20,19);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileBk);
End;
Procedure Edit_Data_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,5);Write('EDIT DATA BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,9);Write('ID : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBk)) Do
Begin
Seek(FileBk,i);
Read(FileBk,DataBk);
If DataBk.ID=NOCR Then
Begin
Ada:=True;
Gotoxy(20,11); Write('Judul Buku : ',DataBk.JudulBk);
Gotoxy(20,13);Write('Pengarang : ',DataBk.Pengarang);
Gotoxy(20,15);Write('Penerbit : ',DataBk.Penerbit);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataBk.ID:=NOCR;
Gotoxy(20,18);Write('Judul Buku : ');Readln(DataBk.JudulBk);
Gotoxy(20,20);Write('Pengarang : ');Readln(DataBk.Pengarang);
Gotoxy(20,22);Write('Penerbit : ');Readln(DataBk.Penerbit);
Seek(FileBk,i);
Write(FileBk,DataBk);
End
Else
Begin
Gotoxy(20,17);Write('ID "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,25);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FileBk);
End;
Procedure Hapus_Data_Buku;
Var
FileTmp : File of Buku;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFileBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'bk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,5);Write('HAPUS DATA BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,9);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBk)) Do
Begin
Seek(FileBk,i);
Read(FileBk,DataBk);
If DataBk.ID=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,11);Write('Judul Buku : ',DataBk.JudulBk);
Gotoxy(20,13);Write('Pengarang : ',DataBk.Pengarang);
Gotoxy(20,15);Write('Penerbit : ',DataBk.Penerbit);
Gotoxy(20,17);Write('Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileBk) Do
Begin
Seek(FileBk,i-1);
Read(FileBk,DataBk);
If DataBk.ID<>NOCR Then
Write(FileTmp,DataBk);
End;
Close(FileBk);
Assign(FileBk,'bk.dat');
Erase(FileBk);
Assign(FileTmp,'bk.tmp');
Rename(FileTmp,'bk.Dat');
Gotoxy(20,20);Write('ID "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,21);Write('ID "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,22);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFileBk;
If IoResult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID JUDUL NAMA NAMA');
Writeln(' BUKU BUKU PENGARANG PENERBIT');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileBk) Do
Begin
Inc(i);
Read(FileBk,DataBk);
Writeln(i:2,DataBk.ID:8,DataBk.JudulBk:37,DataBk.Pengarang:32,DataBk.Penerbit:35);
End;
Writeln('==================================================================================================================');
Close(FileBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Transaksi Peminjaman Buku Pada Perpustakaan}
Type
PinjBk = Record
KBk : Word;
NPjm : String [30];
JuBkSatu : String [30];
JuBkDua : String [30];
JuBkTiga : String [30];
End;
Var
FilePinjBk : File Of PinjBk;
DataPinjBk : PinjBk;
PilihAndaLagi,PilihanAndaLagi,UlangiLagi : Char;
Procedure BukaFilePinjBk;
Begin
Assign(FilePinjBk,'PinjBk.Dat');
{$I-};
Reset(FilePinjBk);
{$I+};
End;
Procedure Tambah_Data_Peminjaman_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFilePinjBk;
If IOResult<>0 Then
Rewrite(FilePinjBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('TAMBAH DATA PEMINJAMAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FilePinjBk)) Do
Begin
Seek(FilePinjBk,i);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,15);Write('KBk "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FilePinjBk,Filesize(FilePinjBk));
DataPinjBk.KBk:=NOCR;
Gotoxy(20,8) ;Write('Nama Peminjam : ');Readln(DataPinjBk.NPjm);
Gotoxy(20,11);Write('Jumlah buku yang boleh dipinjam maksimal hanya boleh 3 (Tiga) Buah Saja !!.');
Gotoxy(20,13);Write('Berikan tanda (-) apabila tidak ada buku yang dipinjam.');
Gotoxy(20,16);Write('Judul Buku 1 : ');Readln(DataPinjBk.JuBkSatu);
Gotoxy(20,18);Write('Judul Buku 2 : ');Readln(DataPinjBk.JuBkDua);
Gotoxy(20,20);Write('Judul Buku 3 : ');Readln(DataPinjBk.JuBkTiga);
Gotoxy(20,23);Write('TERIMA KASIH TELAH BERKUNJUNG DI PERPUSTAKAAN INI');
Gotoxy(20,25);Write('HARAP BUKU YANG TELAH DIPINJAM DAPAT DIKEMBALIKAN SECARA TEPAT WAKTU');
Write(FilePinjBk,DataPinjBk);
End;
Gotoxy(20,28);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FilePinjBk);
End;
Procedure Edit_Data_Peminjaman_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFilePinjBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('EDIT DATA PEMINJAMAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FilePinjBk)) Do
Begin
Seek(FilePinjBk,i);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk=NOCR Then
Begin
Ada:=True;
Gotoxy(20,8) ;Write('Nama Peminjam : ',DataPinjBk.NPjm);
Gotoxy(20,10);Write('Judul Buku 1 : ',DataPinjBk.JuBkSatu);
Gotoxy(20,12);Write('Judul Buku 2 : ',DataPinjBk.JuBkDua);
Gotoxy(20,14);Write('Judul Buku 3 : ',DataPinjBk.JuBkTiga);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataPinjBk.KBk:=NOCR;
Gotoxy(20,18) ;Write('Nama Peminjam : ');Readln(DataPinjBk.NPjm);
Gotoxy(20,20) ;Write('Judul Buku 1 : ');Readln(DataPinjBk.JuBkSatu);
Gotoxy(20,22) ;Write('Judul Buku 2 : ');Readln(DataPinjBk.JuBkDua);
Gotoxy(20,24) ;Write('Judul Buku 3 : ');Readln(DataPinjBk.JuBkTiga);
Seek(FilePinjBk,i);
Write(FilePinjBk,DataPinjBk);
End
Else
Begin
Gotoxy(20,26);Write('KBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,28);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FilePinjBk);
End;
Procedure Hapus_Data_Peminjaman_Buku;
Var
FileTmp : File of PinjBk;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFilePinjBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'pinjbk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,1);Write('HAPUS DATA PEMINJAMAN BUKU');
Gotoxy(30,2);Write('=====================');
Gotoxy(20,4);Write('Kode Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FilePinjBk)) Do
Begin
Seek(FilePinjBk,i);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,13) ;Write('Nama Peminjam : ',DataPinjBk.NPjm);
Gotoxy(20,15) ;Write('Judul Buku 1 : ',DataPinjBk.JuBkSatu);
Gotoxy(20,17) ;Write('Judul Buku 2 : ',DataPinjBk.JuBkDua);
Gotoxy(20,19) ;Write('Judul Buku 3 : ',DataPinjBk.JuBkTiga);
Gotoxy(20,22);Write('Apakah Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FilePinjBk) Do
Begin
Seek(FilePinjBk,i-1);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk<>NOCR Then
Write(FileTmp,DataPinjBk);
End;
Close(FilePinjBk);
Assign(FilePinjBk,'pinjbk.dat');
Erase(FilePinjBk);
Assign(FileTmp,'pinjbk.tmp');
Rename(FileTmp,'pinjbk.dat');
Gotoxy(20,24);Write('KBk "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,15);Write('KBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,16);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Peminjaman_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFilePinjBk;
If IOResult<>0 Then
Write('Maaf Data Masih Kosong !!')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA TRANSAKSI PEMINJAMAN BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID NAMA JUDUL BUKU JUDUL BUKU JUDUL BUKU');
Writeln(' PEMINJAM PEMINJAM PERTAMA KEDUA KETIGA');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FilePinjBk) Do
Begin
Inc(i);
Read(FilePinjBk,DataPinjBk);
Writeln(i:3,DataPinjBk.KBk:5,DataPinjBk.NPjm:21,DataPinjBk.JuBkSatu:26,DataPinjBk.JuBkDua:32,DataPinjBk.JuBkTiga:27);
End;
Writeln('==================================================================================================================');
Close(FilePinjBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Transaksi Pengembalian Buku Pada Perpustakaan}
Type
KembaliBk = Record
KBkB : Word;
NPjmB : String [30];
JuBkSatuB : String [30];
JuBkDuaB : String [30];
JuBkTigaB : String [30];
End;
Var
FileKembaliBk : File Of KembaliBk;
DataKembaliBk : KembaliBk;
PilihAndaLagiB,PilihanAndaLagiB,UlangiLagiB : Char;
Procedure BukaFileKembaliBk;
Begin
Assign(FileKembaliBk,'KembaliBk.Dat');
{$I-};
Reset(FileKembaliBk);
{$I+};
End;
Procedure Tambah_Data_Pengembalian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileKembaliBk;
If IOResult<>0 Then
Rewrite(FileKembaliBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('TAMBAH DATA PENGEMBALIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileKembaliBk)) Do
Begin
Seek(FileKembaliBk,i);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,15);Write('KBk "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileKembaliBk,Filesize(FileKembaliBk));
DataKembaliBk.KBkB:=NOCR;
Gotoxy(20,10);Write('Nama Peminjam : ');Readln(DataKembaliBk.NPjmB);
Gotoxy(20,12);Write('Judul Buku 1 : ');Readln(DataKembaliBk.JuBkSatuB);
Gotoxy(20,14);Write('Judul Buku 2 : ');Readln(DataKembaliBk.JuBkDuaB);
Gotoxy(20,16);Write('Judul Buku 3 : ');Readln(DataKembaliBk.JuBkTigaB);
Gotoxy(20,23);Write('TERIMA KASIH TELAH BERKUNJUNG DI PERPUSTAKAAN INI');
Gotoxy(20,25);Write('KAMI BERHARAP ANDA DAPAT BERKUNJUNG KETEMPAT INI LAGI');
Write(FileKembaliBk,DataKembaliBk);
End;
Gotoxy(20,28);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileKembaliBk);
End;
Procedure Edit_Data_Pengembalian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileKembaliBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('EDIT DATA PENGEMBALIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileKembaliBk)) Do
Begin
Seek(FileKembaliBk,i);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB=NOCR Then
Begin
Ada:=True;
Gotoxy(20,8) ;Write('Nama Peminjam : ',DataKembaliBk.NPjmB);
Gotoxy(20,10);Write('Judul Buku 1 : ',DataKembaliBk.JuBkSatuB);
Gotoxy(20,12);Write('Judul Buku 2 : ',DataKembaliBk.JuBkDuaB);
Gotoxy(20,14);Write('Judul Buku 3 : ',DataKembaliBk.JuBkTigaB);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataKembaliBk.KBkB:=NOCR;
Gotoxy(20,18) ;Write('Nama Peminjam : ');Readln(DataKembaliBk.NPjmB);
Gotoxy(20,20) ;Write('Judul Buku 1 : ');Readln(DataKembaliBk.JuBkSatuB);
Gotoxy(20,22) ;Write('Judul Buku 2 : ');Readln(DataKembaliBk.JuBkDuaB);
Gotoxy(20,24) ;Write('Judul Buku 3 : ');Readln(DataKembaliBk.JuBkTigaB);
Seek(FileKembaliBk,i);
Write(FileKembaliBk,DataKembaliBk);
End
Else
Begin
Gotoxy(20,26);Write('KBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,28);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FileKembaliBk);
End;
Procedure Hapus_Data_Pengembalian_Buku;
Var
FileTmp : File of KembaliBk;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFileKembaliBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'kembalibk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,1);Write('HAPUS DATA PENGEMBALIAN BUKU');
Gotoxy(30,2);Write('=====================');
Gotoxy(20,4);Write('Kode Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileKembaliBk)) Do
Begin
Seek(FileKembaliBk,i);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,13) ;Write('Nama Peminjam : ',DataKembaliBk.NPjmB);
Gotoxy(20,15) ;Write('Judul Buku 1 : ',DataKembaliBk.JuBkSatuB);
Gotoxy(20,17) ;Write('Judul Buku 2 : ',DataKembaliBk.JuBkDuaB);
Gotoxy(20,19) ;Write('Judul Buku 3 : ',DataKembaliBk.JuBkTigaB);
Gotoxy(20,22);Write('Apakah Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileKembaliBk) Do
Begin
Seek(FileKembaliBk,i-1);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB<>NOCR Then
Write(FileTmp,DataKembaliBk);
End;
Close(FileKembaliBk);
Assign(FileKembaliBk,'kembalibk.Dat');
Erase(FileKembaliBk);
Assign(FileTmp,'kembalibk.tmp');
Rename(FileTmp,'kembalibk.Dat');
Gotoxy(20,24);Write('KBkB "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,15);Write('KBkB "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,16);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Pengembalian_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFileKembaliBk;
If IOResult<>0 Then
Write('Maaf Data Masih Kosong !!')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA TRANSAKSI PENGEMBALIAN BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID NAMA JUDUL BUKU JUDUL BUKU JUDUL BUKU');
Writeln(' PEMINJAM PEMINJAM PERTAMA KEDUA KETIGA');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileKembaliBk) Do
Begin
Inc(i);
Read(FileKembaliBk,DataKembaliBk);
Writeln(i:3,DataKembaliBk.KBkB:5,DataKembaliBk.NPjmB:21,DataKembaliBk.JuBkSatuB:26,DataKembaliBk.JuBkDuaB:32,
DataKembaliBk.JuBkTigaB:27);
End;
Writeln('==================================================================================================================');
Close(FileKembaliBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Transaksi Pembelian Buku Pada Perpustakaan}
Type
BelBk = Record
IDBk : Word;
JuBk : String [30];
Karangan : String [30];
Terbitan : String [30];
HargaBk : Real;
End;
Var
FileBelBk : File Of BelBk;
DataBelBk : BelBk;
PilihAnda,PilihanAnda,Ulangi : Char;
Procedure BukaFileBelBk;
Begin
Assign(FileBelBk,'BelBk.Dat');
{$I-};
Reset(FileBelBk);
{$I+};
End;
Procedure Tambah_Data_Pembelian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBelBk;
If IOResult<>0 Then
Rewrite(FileBelBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('TAMBAH DATA PEMBELIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBelBk)) Do
Begin
Seek(FileBelBk,i);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,15);Write('IDBk "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileBelBk,Filesize(FileBelBk));
DataBelBk.IDBk:=NOCR;
Gotoxy(20,8);Write('Judul Buku : ');Readln(DataBelBk.JuBk);
Gotoxy(20,10);Write('Pengarang : ');Readln(DataBelBk.Karangan);
Gotoxy(20,12);Write('Penerbit : ');Readln(DataBelBk.Terbitan);
Gotoxy(20,14);Write('Harga : ');Readln(DataBelBk.HargaBk);
Write(FileBelBk,DataBelBk);
End;
Gotoxy(20,17);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileBelBk);
End;
Procedure Edit_Data_Pembelian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBelBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('EDIT DATA PEMBELIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBelBk)) Do
Begin
Seek(FileBelBk,i);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk=NOCR Then
Begin
Ada:=True;
Gotoxy(20,8);Write('Judul Buku : ',DataBelBk.JuBk);
Gotoxy(20,10);Write('Pengarang : ',DataBelBk.Karangan);
Gotoxy(20,12);Write('Penerbit : ',DataBelBk.Terbitan);
Gotoxy(20,14);Write('Harga : ',DataBelBk.HargaBk:0:0);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataBelBk.IDBk:=NOCR;
Gotoxy(20,17);Write('Judul Buku : ');Readln(DataBelBk.JuBk);
Gotoxy(20,19);Write('Pengarang : ');Readln(DataBelBk.Karangan);
Gotoxy(20,21);Write('Penerbit : ');Readln(DataBelBk.Terbitan);
Gotoxy(20,23);Write('Harga : ');Readln(DataBelBk.HargaBk);
Seek(FileBelBk,i);
Write(FileBelBk,DataBelBk);
End
Else
Begin
Gotoxy(20,20);Write('IDBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,24);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FileBelBk);
End;
Procedure Hapus_Data_Pembelian_Buku;
Var
FileTmp : File of BelBk;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFileBelBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'belbk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,4);Write('HAPUS DATA PEMBELIAN BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,8);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBelBk)) Do
Begin
Seek(FileBelBk,i);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,11);Write('Judul Buku : ',DataBelBk.JuBk);
Gotoxy(20,13);Write('Pengarang : ',DataBelBk.Karangan);
Gotoxy(20,15);Write('Penerbit : ',DataBelBk.Terbitan);
Gotoxy(20,17);Write('Harga : ',DataBelBk.HargaBk);
Gotoxy(20,20);Write('Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileBelBk) Do
Begin
Seek(FileBelBk,i-1);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk<>NOCR Then
Write(FileTmp,DataBelBk);
End;
Close(FileBelBk);
Assign(FileBelBk,'belbk.Dat');
Erase(FileBelBk);
Assign(FileTmp,'belbk.tmp');
Rename(FileTmp,'belbk.Dat');
Gotoxy(20,23);Write('IDBk "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,24);Write('IDBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,25);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Pembelian_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFileBelBk;
If IOResult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA TRANSAKSI PEMBELIAN BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID JUDUL NAMA NAMA HARGA');
Writeln(' BUKU BUKU PENGARANG PENERBIT BUKU');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileBelBk) Do
Begin
Inc(i);
Read(FileBelBk,DataBelBk);
Writeln(i:2,DataBelBk.IDBk:8,DataBelBk.JuBk:25,DataBelBk.Karangan:27,DataBelBk.Terbitan:29,DataBelBk.HargaBk:23:0);
End;
Writeln('==================================================================================================================');
Close(FileBelBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
Procedure Help;
Begin
Ul:='Y';
Clrscr;
GotoXY(42,4) ; Write('===================================================');
GotoXY(50,5) ; Write('TUTORIAL PENGGUNAAAN APLIKASI INI : ');
GotoXY(42,6) ; Write('===================================================');
GotoXY(32,8) ; Write('1. Saat pertama kali menjalankan aplikasi ini, anda akan masuk pada menu utama.');
GotoXY(32,10); Write('2. Pilihlah salah satu menu program yang ingin anda buka, ');
GotoXY(32,11); Write(' yaitu dengan menekan huruf besar tertentu, (sesuai dengan kode program yang ada)');
GotoXY(32,12); Write(' Contohnya : tekan huruf D (besar) untuk melihat menudaftar data mahasiswa.');
GotoXY(32,14); Write('3. Apabila anda tekan huruf tertentu diluar kode yang ada, maka aplikasi ini');
GotoXY(32,15); Write(' tidak akan merespon, bahkan bisa keluar sendiri, atau tetap pada keadaan semula.');
GotoXY(32,17); Write('4. Pakailah aplikasi ini sebagaimana - mestinya dan secara bijaksana');
GotoXY(32,19); Write('5. Saya mohon maaf apabila menurut anda aplikasi ini masih jauh dari kata sempurna.');
GotoXY(32,20); Write(' Segala komentar, kritik serta saran siap saya terima mengenai aplikasi ini,');
GotoXY(32,21); Write(' agar saya dapat mengembangkan aplikasi ini jauh lebih baik lagi dari sekarang ini.');
GotoXY(42,26); Writeln('===================================================');
GotoXY(57,27); Write('SEKIAN DAN TERIMA KASIH.');
GotoXY(42,28); Writeln('===================================================');
GotoXY(53,31); Write('Tekan Apa Saja Untuk Kembali !!');Readkey
End;
Procedure About;
Begin
Ul:='Y';
Clrscr;
GotoXY(42,4) ; Write('===================================================');
GotoXY(51,5) ; Write('PROGRAM INI TELAH DIBUAT OLEH : ');
GotoXY(42,6) ; Write('===================================================');
GotoXY(49,9) ; Write('Nama : Gamaliel');
GotoXY(49,11); Write('NIM : C1457201006');
GotoXY(49,13); Write('Mata Kuliah : Algoritma & Pemrograman I');
GotoXY(49,15); Write('Jurusan : Sistem Informasi Kelas A');
GotoXY(49,17); Write('Dosen Pengampu : Arliyana S.Kom');
GotoXY(42,22); Writeln('=================================================');
GotoXY(42,23); Write('SEKOLAH TINGGI MANAJEMEN INFORMATIKA DAN KOMPUTER');
GotoXY(57,24); Write('STMIK PALANGKARAYA');
GotoXY(61,25); Write('TAHUN 2014');
GotoXY(42,26); Writeln('=================================================');
GotoXY(50,30); Write('Tekan Apa Saja Untuk Kembali !!');Readkey
End;
Begin
Repeat
Menu_Utama;
Case Pil Of
'A' : Tambah_Data_Anggota;
'B' : Edit_Data_Anggota;
'C' : Hapus_Data_Anggota;
'D' : Tampil_Data_Anggota;
'E' : Cari_Nama_Anggota;
'F' : Tambah_Data_Buku;
'G' : Edit_Data_Buku;
'H' : Hapus_Data_Buku;
'I' : Tampil_Data_Buku;
'J' : Tambah_Data_Pembelian_Buku;
'K' : Edit_Data_Pembelian_Buku;
'L' : Hapus_Data_Pembelian_Buku;
'M' : Tampil_Data_Pembelian_Buku;
'N' : Tambah_Data_Peminjaman_Buku;
'O' : Edit_Data_Peminjaman_Buku;
'P' : Hapus_Data_Peminjaman_Buku;
'Q' : Tampil_Data_Peminjaman_Buku;
'R' : Tambah_Data_Pengembalian_Buku;
'S' : Edit_Data_Pengembalian_Buku;
'T' : Hapus_Data_Pengembalian_Buku;
'U' : Tampil_Data_Pengembalian_Buku;
'W' : Help;
'Y' : About;
End;
Until (Ul<>'Y') Or (Pil='X');
DoneWinCrt;
End.
Uses WinCrt;
Type
Mahasiswa = Record
NIM : Word;
Nama : String[15];
JK : Char;
Jenis_Kelamin : String[10];
TTL : String[30];
Alamat : String[25];
Jur : Char;
Jurusan : String[22];
End;
Var
FileMhs : File of Mahasiswa;
Data : Mahasiswa;
Pil,Pilihan,Ul : Char;
Procedure Menu_Utama;
Begin
Screensize.X := 168;
Screensize.Y := 45;
Clrscr;
Gotoxy(36,4) ;Write('======================================================================================================');
Gotoxy(59,5) ;Write('APLIKASI DATA PERPUSTAKAAN KAMPUS STMIK PALANGKARAYA ');
Gotoxy(36,6) ;Write('======================================================================================================');
Gotoxy(36,8) ;Write('MENU DATA ANGGOTA');
Gotoxy(36,9) ;Write('=========================');
Gotoxy(36,11);Write('A. Tambah Data Anggota');
Gotoxy(36,13);Write('B. Edit Data Anggota');
Gotoxy(36,15);Write('C. Hapus Data Anggota');
Gotoxy(36,17);Write('D. Tampilkan Data Anggota');
Gotoxy(36,19);Write('E. Pencarian ');
Gotoxy(76,8) ;Write('MENU DATA BUKU');
Gotoxy(76,9) ;Write('======================');
Gotoxy(76,11);Write('F. Tambah Data Buku');
Gotoxy(76,13);Write('G. Edit Data Buku');
Gotoxy(76,15);Write('H. Hapus Data Buku');
Gotoxy(76,17);Write('I. Tampilkan Data Buku');
Gotoxy(111,8) ;Write('MENU DATA PEMBELIAN BUKU ');
Gotoxy(111,9) ;Write('========================');
Gotoxy(111,11);Write('J. Tambah Data Transaksi');
Gotoxy(111,13);Write('K. Edit Data Transaksi');
Gotoxy(111,15);Write('L. Hapus Data Transaksi');
Gotoxy(111,17);Write('M. Tampilkan Data Transaksi');
Gotoxy(36,21);Write('======================================================================================================');
Gotoxy(50,23);Write('MENU DATA PEMINJAMAN BUKU ');
Gotoxy(50,24);Write('============================');
Gotoxy(50,26);Write('N. Tambah Data Peminjaman');
Gotoxy(50,28);Write('O. Edit Data Peminjaman');
Gotoxy(50,30);Write('P. Hapus Data Peminjaman');
Gotoxy(50,32);Write('Q. Tampilkan Data Peminjaman');
Gotoxy(98,23);Write('MENU DATA PENGEMBALIAN BUKU ');
Gotoxy(98,24);Write('==============================');
Gotoxy(98,26);Write('R. Tambah Data Pengembalian');
Gotoxy(98,28);Write('S. Edit Data Pengembalian');
Gotoxy(98,30);Write('T. Hapus Data Pengembalian');
Gotoxy(98,32);Write('U. Tampilkan Data Pengembalian');
Gotoxy(36,35);Write('======================================================================================================');
Gotoxy(81,36);Write('W. Bantuan (?) ');
Gotoxy(75,38);Write('Y. Tentang Aplikasi Ini (i) ');
Gotoxy(80,40);Write('X. Keluar (Exit)');
Gotoxy(36,41);Write('======================================================================================================');
Gotoxy(75,43);Write('Masukkan Pilihan Anda [A..X]: ');Pil:=Readkey;
End;
{Procedure Untuk Menangani Data Anggota Perpustakaan}
Procedure BukaFile;
Begin
Assign(FileMhs,'Mhs.Dat');
{$I-};
Reset(FileMhs);
{$I+};
End;
Procedure Tambah_Data_Anggota;
Var
Lagi : Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
Rewrite(FileMhs);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(55,4);Write('TAMBAH DATA ANGGOTA');
Gotoxy(55,5);Write('===================');
Gotoxy(53,7);Write('NIM : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileMhs)) Do
Begin
Seek(FileMhs,i);
Read(FileMhs,Data);
If Data.NIM=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(49,15);Write('NIM Anggota "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileMhs,Filesize(FileMhs));
Data.NIM:=NOCR;
Gotoxy(53,9);Write('Nama Anggota : ');Readln(Data.Nama);
Gotoxy(53,11);Write('Jenis Kelamin (L:Laki-laki dan P : Perempuan):');Readln(Data.JK);
If (Data.JK = 'L') or (Data.JK='l') then
Data.Jenis_Kelamin:='Laki-laki'
Else
If (Data.JK='P') or (Data.JK='p') then
Data.Jenis_Kelamin:='Perempuan'
Else
Data.Jenis_Kelamin:='Tidak Ada';
Gotoxy(53,13) ;Write('Jenis Kelamin Anda : ', Data.Jenis_Kelamin);
Gotoxy(53,15);Write('TTL : ');Readln(Data.TTL);
Gotoxy(53,17);Write('Alamat : ');Readln(Data.Alamat);
Gotoxy(53,19);Write('Jurusan : ');Readln(Data.Jur);
If(Data.Jur='M')or(Data.Jur='m') then
Data.Jurusan:='Manajemen Informartika'
Else
If(Data.Jur='S')or(Data.Jur='s')then
Data.Jurusan:='Sistem Informasi'
Else
If(Data.Jur='T')or(Data.Jur='t')then
Data.Jurusan:='Teknik Informatika'
Else
Data.Jurusan:='Tidak Ada';
Gotoxy(53,21);Write('Jurusan Anda:',Data.Jurusan);
Write(FileMhs,Data);
End;
Gotoxy(20,26);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileMhs);
End;
Procedure Edit_Data_Anggota;
Var
Lagi : Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
Write('Data Masih Kosong....!!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(55,4);Write('EDIT DATA ANGGOTA');
Gotoxy(55,5);Write('=================');
Gotoxy(55,7);Write('NIM : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileMhs)) Do
Begin
Seek(FileMhs,i);
Read(FileMhs,Data);
If Data.NIM=NOCR Then
Begin
Ada:=True;
Gotoxy(55,9) ;Write('Nama Anggota : ',Data.Nama);
Gotoxy(55,11);Write('Jenis Kelamin : ',Data.Jenis_Kelamin);
Gotoxy(55,13);Write('TTL : ',Data.TTL);
Gotoxy(55,15);Write('Alamat : ',Data.Alamat);
Gotoxy(55,17);Write('Jurusan : ',Data.Jurusan);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Data.NIM:=NOCR;
Gotoxy(55,23);Write('Nama Anggota : ');Readln(Data.Nama);
Gotoxy(55,25);Write('Jenis Kelamin (L:Laki-laki dan P : Perempuan):');Readln(Data.JK);
If (Data.JK = 'L') or (Data.JK='l') then
Data.Jenis_Kelamin:='Laki-laki'
Else
If (Data.JK='P') or (Data.JK='p') then
Data.Jenis_Kelamin:='Perempuan'
Else
Data.Jenis_Kelamin:='Tidak Ada';
Gotoxy(55,27);Write('Jenis Kelamin Anda : ', Data.Jenis_Kelamin);
Gotoxy(55,29);Write('TTL : ');Readln(Data.TTL);
Gotoxy(55,31);Write('Alamat : ');Readln(Data.Alamat);
Gotoxy(55,35);Write('Jurusan : ');Readln(Data.Jur);
If(Data.Jur='M')or(Data.JK='m') then
Data.Jurusan:='Manajemen Informartika'
Else
If(Data.Jur='S')or(Data.Jur='s')then
Data.Jurusan:='Sistem Informasi'
Else
If(Data.Jur='T')or(Data.Jur='t')then
Data.Jurusan:='Teknik Informatika'
Else
Data.Jurusan:='Tidak Ada';
Gotoxy(55,36);Write('Jurusan Anda : ', Data.Jurusan);
Seek(FileMhs,i);
Write(FileMhs,Data);
End
Else
Begin
Gotoxy(55,15);Write('NIM Anggota "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(55,38);Write('Mau Edit Data Lagi ? [Y/T] : ');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(Filemhs);
End;
Procedure Hapus_Data_Anggota;
Var
FileTmp : File of Mahasiswa;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFile;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'mhs.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(55,4);Write('HAPUS DATA ANGGOTA');
Gotoxy(55,5);Write('==================');
Gotoxy(52,7);Write('NIM : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileMhs)) Do
Begin
Seek(FileMhs,i);
Read(FileMhs,Data);
If Data.NIM=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(52,9) ;Write('Nama Anggota : ',Data.Nama);
Gotoxy(52,11);Write('Jenis Kelamin : ',Data.Jenis_Kelamin);
Gotoxy(52,13);Write('TTL : ',Data.TTL);
Gotoxy(52,15);Write('Alamat : ',Data.Alamat);
Gotoxy(52,19);Write('Jurusan : ',Data.Jurusan);
Gotoxy(52,22);Write('Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileMhs) Do
Begin
Seek(FileMhs,i-1);
Read(FileMhs,Data);
If Data.NIM<>NOCR Then
Write(FileTmp,Data);
End;
Close(FileMhs);
Assign(FileMhs,'MHS.Dat');
Erase(FileMhs);
Assign(FileTmp,'Mhs.tmp');
Rename(FileTmp,'Mhs.Dat');
Gotoxy(52,24);Write('NIM "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(52,19);Write('NIM "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(52,26);Write('Mau Hapus Data Lagi [Y/T] : ');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Anggota;
Var
i:Integer;
Begin
Ul:='Y';
BukaFile;
If IoResult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Clrscr;
Writeln;
Writeln;
Writeln(' =========================');
Writeln(' DATA ANGGOTA PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln(' =========================');
Writeln;
Writeln(' Masa Berlaku s/d : 2020');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO NIM NAMA JENIS TEMPAT/ ALAMAT JURUSAN');
Writeln(' ANGGOTA KELAMIN TANGGAL LAHIR ANGGOTA ');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileMhs) Do
Begin
Inc(i);
Read(FileMhs,Data);
Writeln(i:2,Data.NIM:7,Data.Nama:15,Data.Jenis_Kelamin:17,Data.TTL:26,Data.Alamat:22,Data.Jurusan:25);
End;
Writeln('==================================================================================================================');
Close(FileMhs);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Pencarian Nama Anggota}
Procedure Cari_Nama_Anggota;
Var
i : Integer;
NA : String[10];
Lagi : Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat
Clrscr;
Writeln;
Writeln;
Write(' Cari Nama Anggota : ');Readln(NA);
BukaFile;
If IoResult <> 0 Then
Write('Maaf Data Masih Kosong ! ')
Else
Begin
Clrscr;
Writeln;
Writeln;
Writeln(' =========================');
Writeln(' DATA ANGGOTA PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln(' =========================');
Writeln;
Writeln(' Masa Berlaku s/d : 2020');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO NIM NAMA JENIS TEMPAT/ ALAMAT JURUSAN');
Writeln(' ANGGOTA KELAMIN TANGGAL LAHIR ANGGOTA ');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileMhs) Do
Begin
Read(FileMhs,Data);
If Data.Nama=NA Then
Begin
Inc(i);
Writeln(i:2,Data.NIM:7,Data.Nama:15,Data.Jenis_Kelamin:17,Data.TTL:26,Data.Alamat:22,Data.Jurusan:25);
End;
End;
Writeln('==================================================================================================================');
Close(FileMhs);
End;
Writeln;
Write('Mau Lihat Data Lagi [Y/T]: ');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
{Procedure Untuk Menangani Data Buku Perpustakaan}
Type
Buku = Record
ID : Word;
JudulBk : String [30];
Pengarang : String [30];
Penerbit : String [30];
End;
Var
FileBk : File Of Buku;
DataBk : Buku;
Pilih,Pilihannya,Ulang : Char;
Procedure BukaFileBk;
Begin
Assign(FileBk,'Bk.Dat');
{$I-};
Reset(FileBk);
{$I+};
End;
Procedure Tambah_Data_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBk;
If IOResult<>0 Then
Rewrite(FileBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,5);Write('TAMBAH DATA BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,9);Write('ID : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBk)) Do
Begin
Seek(FileBk,i);
Read(FileBk,DataBk);
If DataBk.ID=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,13);Write('ID "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileBk,Filesize(FileBk));
DataBk.ID:=NOCR;
Gotoxy(20,11); Write('Judul Buku : ');Readln(DataBk.JudulBk);
Gotoxy(20,13);Write('Pengarang : ');Readln(DataBk.Pengarang);
Gotoxy(20,15);Write('Penerbit : ');Readln(DataBk.Penerbit);
Write(FileBk,DataBk);
End;
Gotoxy(20,19);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileBk);
End;
Procedure Edit_Data_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,5);Write('EDIT DATA BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,9);Write('ID : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBk)) Do
Begin
Seek(FileBk,i);
Read(FileBk,DataBk);
If DataBk.ID=NOCR Then
Begin
Ada:=True;
Gotoxy(20,11); Write('Judul Buku : ',DataBk.JudulBk);
Gotoxy(20,13);Write('Pengarang : ',DataBk.Pengarang);
Gotoxy(20,15);Write('Penerbit : ',DataBk.Penerbit);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataBk.ID:=NOCR;
Gotoxy(20,18);Write('Judul Buku : ');Readln(DataBk.JudulBk);
Gotoxy(20,20);Write('Pengarang : ');Readln(DataBk.Pengarang);
Gotoxy(20,22);Write('Penerbit : ');Readln(DataBk.Penerbit);
Seek(FileBk,i);
Write(FileBk,DataBk);
End
Else
Begin
Gotoxy(20,17);Write('ID "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,25);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FileBk);
End;
Procedure Hapus_Data_Buku;
Var
FileTmp : File of Buku;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFileBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'bk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,5);Write('HAPUS DATA BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,9);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBk)) Do
Begin
Seek(FileBk,i);
Read(FileBk,DataBk);
If DataBk.ID=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,11);Write('Judul Buku : ',DataBk.JudulBk);
Gotoxy(20,13);Write('Pengarang : ',DataBk.Pengarang);
Gotoxy(20,15);Write('Penerbit : ',DataBk.Penerbit);
Gotoxy(20,17);Write('Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileBk) Do
Begin
Seek(FileBk,i-1);
Read(FileBk,DataBk);
If DataBk.ID<>NOCR Then
Write(FileTmp,DataBk);
End;
Close(FileBk);
Assign(FileBk,'bk.dat');
Erase(FileBk);
Assign(FileTmp,'bk.tmp');
Rename(FileTmp,'bk.Dat');
Gotoxy(20,20);Write('ID "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,21);Write('ID "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,22);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFileBk;
If IoResult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID JUDUL NAMA NAMA');
Writeln(' BUKU BUKU PENGARANG PENERBIT');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileBk) Do
Begin
Inc(i);
Read(FileBk,DataBk);
Writeln(i:2,DataBk.ID:8,DataBk.JudulBk:37,DataBk.Pengarang:32,DataBk.Penerbit:35);
End;
Writeln('==================================================================================================================');
Close(FileBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Transaksi Peminjaman Buku Pada Perpustakaan}
Type
PinjBk = Record
KBk : Word;
NPjm : String [30];
JuBkSatu : String [30];
JuBkDua : String [30];
JuBkTiga : String [30];
End;
Var
FilePinjBk : File Of PinjBk;
DataPinjBk : PinjBk;
PilihAndaLagi,PilihanAndaLagi,UlangiLagi : Char;
Procedure BukaFilePinjBk;
Begin
Assign(FilePinjBk,'PinjBk.Dat');
{$I-};
Reset(FilePinjBk);
{$I+};
End;
Procedure Tambah_Data_Peminjaman_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFilePinjBk;
If IOResult<>0 Then
Rewrite(FilePinjBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('TAMBAH DATA PEMINJAMAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FilePinjBk)) Do
Begin
Seek(FilePinjBk,i);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,15);Write('KBk "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FilePinjBk,Filesize(FilePinjBk));
DataPinjBk.KBk:=NOCR;
Gotoxy(20,8) ;Write('Nama Peminjam : ');Readln(DataPinjBk.NPjm);
Gotoxy(20,11);Write('Jumlah buku yang boleh dipinjam maksimal hanya boleh 3 (Tiga) Buah Saja !!.');
Gotoxy(20,13);Write('Berikan tanda (-) apabila tidak ada buku yang dipinjam.');
Gotoxy(20,16);Write('Judul Buku 1 : ');Readln(DataPinjBk.JuBkSatu);
Gotoxy(20,18);Write('Judul Buku 2 : ');Readln(DataPinjBk.JuBkDua);
Gotoxy(20,20);Write('Judul Buku 3 : ');Readln(DataPinjBk.JuBkTiga);
Gotoxy(20,23);Write('TERIMA KASIH TELAH BERKUNJUNG DI PERPUSTAKAAN INI');
Gotoxy(20,25);Write('HARAP BUKU YANG TELAH DIPINJAM DAPAT DIKEMBALIKAN SECARA TEPAT WAKTU');
Write(FilePinjBk,DataPinjBk);
End;
Gotoxy(20,28);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FilePinjBk);
End;
Procedure Edit_Data_Peminjaman_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFilePinjBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('EDIT DATA PEMINJAMAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FilePinjBk)) Do
Begin
Seek(FilePinjBk,i);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk=NOCR Then
Begin
Ada:=True;
Gotoxy(20,8) ;Write('Nama Peminjam : ',DataPinjBk.NPjm);
Gotoxy(20,10);Write('Judul Buku 1 : ',DataPinjBk.JuBkSatu);
Gotoxy(20,12);Write('Judul Buku 2 : ',DataPinjBk.JuBkDua);
Gotoxy(20,14);Write('Judul Buku 3 : ',DataPinjBk.JuBkTiga);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataPinjBk.KBk:=NOCR;
Gotoxy(20,18) ;Write('Nama Peminjam : ');Readln(DataPinjBk.NPjm);
Gotoxy(20,20) ;Write('Judul Buku 1 : ');Readln(DataPinjBk.JuBkSatu);
Gotoxy(20,22) ;Write('Judul Buku 2 : ');Readln(DataPinjBk.JuBkDua);
Gotoxy(20,24) ;Write('Judul Buku 3 : ');Readln(DataPinjBk.JuBkTiga);
Seek(FilePinjBk,i);
Write(FilePinjBk,DataPinjBk);
End
Else
Begin
Gotoxy(20,26);Write('KBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,28);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FilePinjBk);
End;
Procedure Hapus_Data_Peminjaman_Buku;
Var
FileTmp : File of PinjBk;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFilePinjBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'pinjbk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,1);Write('HAPUS DATA PEMINJAMAN BUKU');
Gotoxy(30,2);Write('=====================');
Gotoxy(20,4);Write('Kode Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FilePinjBk)) Do
Begin
Seek(FilePinjBk,i);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,13) ;Write('Nama Peminjam : ',DataPinjBk.NPjm);
Gotoxy(20,15) ;Write('Judul Buku 1 : ',DataPinjBk.JuBkSatu);
Gotoxy(20,17) ;Write('Judul Buku 2 : ',DataPinjBk.JuBkDua);
Gotoxy(20,19) ;Write('Judul Buku 3 : ',DataPinjBk.JuBkTiga);
Gotoxy(20,22);Write('Apakah Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FilePinjBk) Do
Begin
Seek(FilePinjBk,i-1);
Read(FilePinjBk,DataPinjBk);
If DataPinjBk.KBk<>NOCR Then
Write(FileTmp,DataPinjBk);
End;
Close(FilePinjBk);
Assign(FilePinjBk,'pinjbk.dat');
Erase(FilePinjBk);
Assign(FileTmp,'pinjbk.tmp');
Rename(FileTmp,'pinjbk.dat');
Gotoxy(20,24);Write('KBk "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,15);Write('KBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,16);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Peminjaman_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFilePinjBk;
If IOResult<>0 Then
Write('Maaf Data Masih Kosong !!')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA TRANSAKSI PEMINJAMAN BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID NAMA JUDUL BUKU JUDUL BUKU JUDUL BUKU');
Writeln(' PEMINJAM PEMINJAM PERTAMA KEDUA KETIGA');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FilePinjBk) Do
Begin
Inc(i);
Read(FilePinjBk,DataPinjBk);
Writeln(i:3,DataPinjBk.KBk:5,DataPinjBk.NPjm:21,DataPinjBk.JuBkSatu:26,DataPinjBk.JuBkDua:32,DataPinjBk.JuBkTiga:27);
End;
Writeln('==================================================================================================================');
Close(FilePinjBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Transaksi Pengembalian Buku Pada Perpustakaan}
Type
KembaliBk = Record
KBkB : Word;
NPjmB : String [30];
JuBkSatuB : String [30];
JuBkDuaB : String [30];
JuBkTigaB : String [30];
End;
Var
FileKembaliBk : File Of KembaliBk;
DataKembaliBk : KembaliBk;
PilihAndaLagiB,PilihanAndaLagiB,UlangiLagiB : Char;
Procedure BukaFileKembaliBk;
Begin
Assign(FileKembaliBk,'KembaliBk.Dat');
{$I-};
Reset(FileKembaliBk);
{$I+};
End;
Procedure Tambah_Data_Pengembalian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileKembaliBk;
If IOResult<>0 Then
Rewrite(FileKembaliBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('TAMBAH DATA PENGEMBALIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileKembaliBk)) Do
Begin
Seek(FileKembaliBk,i);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,15);Write('KBk "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileKembaliBk,Filesize(FileKembaliBk));
DataKembaliBk.KBkB:=NOCR;
Gotoxy(20,10);Write('Nama Peminjam : ');Readln(DataKembaliBk.NPjmB);
Gotoxy(20,12);Write('Judul Buku 1 : ');Readln(DataKembaliBk.JuBkSatuB);
Gotoxy(20,14);Write('Judul Buku 2 : ');Readln(DataKembaliBk.JuBkDuaB);
Gotoxy(20,16);Write('Judul Buku 3 : ');Readln(DataKembaliBk.JuBkTigaB);
Gotoxy(20,23);Write('TERIMA KASIH TELAH BERKUNJUNG DI PERPUSTAKAAN INI');
Gotoxy(20,25);Write('KAMI BERHARAP ANDA DAPAT BERKUNJUNG KETEMPAT INI LAGI');
Write(FileKembaliBk,DataKembaliBk);
End;
Gotoxy(20,28);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileKembaliBk);
End;
Procedure Edit_Data_Pengembalian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileKembaliBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('EDIT DATA PENGEMBALIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileKembaliBk)) Do
Begin
Seek(FileKembaliBk,i);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB=NOCR Then
Begin
Ada:=True;
Gotoxy(20,8) ;Write('Nama Peminjam : ',DataKembaliBk.NPjmB);
Gotoxy(20,10);Write('Judul Buku 1 : ',DataKembaliBk.JuBkSatuB);
Gotoxy(20,12);Write('Judul Buku 2 : ',DataKembaliBk.JuBkDuaB);
Gotoxy(20,14);Write('Judul Buku 3 : ',DataKembaliBk.JuBkTigaB);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataKembaliBk.KBkB:=NOCR;
Gotoxy(20,18) ;Write('Nama Peminjam : ');Readln(DataKembaliBk.NPjmB);
Gotoxy(20,20) ;Write('Judul Buku 1 : ');Readln(DataKembaliBk.JuBkSatuB);
Gotoxy(20,22) ;Write('Judul Buku 2 : ');Readln(DataKembaliBk.JuBkDuaB);
Gotoxy(20,24) ;Write('Judul Buku 3 : ');Readln(DataKembaliBk.JuBkTigaB);
Seek(FileKembaliBk,i);
Write(FileKembaliBk,DataKembaliBk);
End
Else
Begin
Gotoxy(20,26);Write('KBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,28);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FileKembaliBk);
End;
Procedure Hapus_Data_Pengembalian_Buku;
Var
FileTmp : File of KembaliBk;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFileKembaliBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'kembalibk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,1);Write('HAPUS DATA PENGEMBALIAN BUKU');
Gotoxy(30,2);Write('=====================');
Gotoxy(20,4);Write('Kode Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileKembaliBk)) Do
Begin
Seek(FileKembaliBk,i);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,13) ;Write('Nama Peminjam : ',DataKembaliBk.NPjmB);
Gotoxy(20,15) ;Write('Judul Buku 1 : ',DataKembaliBk.JuBkSatuB);
Gotoxy(20,17) ;Write('Judul Buku 2 : ',DataKembaliBk.JuBkDuaB);
Gotoxy(20,19) ;Write('Judul Buku 3 : ',DataKembaliBk.JuBkTigaB);
Gotoxy(20,22);Write('Apakah Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileKembaliBk) Do
Begin
Seek(FileKembaliBk,i-1);
Read(FileKembaliBk,DataKembaliBk);
If DataKembaliBk.KBkB<>NOCR Then
Write(FileTmp,DataKembaliBk);
End;
Close(FileKembaliBk);
Assign(FileKembaliBk,'kembalibk.Dat');
Erase(FileKembaliBk);
Assign(FileTmp,'kembalibk.tmp');
Rename(FileTmp,'kembalibk.Dat');
Gotoxy(20,24);Write('KBkB "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,15);Write('KBkB "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,16);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Pengembalian_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFileKembaliBk;
If IOResult<>0 Then
Write('Maaf Data Masih Kosong !!')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA TRANSAKSI PENGEMBALIAN BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID NAMA JUDUL BUKU JUDUL BUKU JUDUL BUKU');
Writeln(' PEMINJAM PEMINJAM PERTAMA KEDUA KETIGA');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileKembaliBk) Do
Begin
Inc(i);
Read(FileKembaliBk,DataKembaliBk);
Writeln(i:3,DataKembaliBk.KBkB:5,DataKembaliBk.NPjmB:21,DataKembaliBk.JuBkSatuB:26,DataKembaliBk.JuBkDuaB:32,
DataKembaliBk.JuBkTigaB:27);
End;
Writeln('==================================================================================================================');
Close(FileKembaliBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
{Procedure Untuk Menangani Data Transaksi Pembelian Buku Pada Perpustakaan}
Type
BelBk = Record
IDBk : Word;
JuBk : String [30];
Karangan : String [30];
Terbitan : String [30];
HargaBk : Real;
End;
Var
FileBelBk : File Of BelBk;
DataBelBk : BelBk;
PilihAnda,PilihanAnda,Ulangi : Char;
Procedure BukaFileBelBk;
Begin
Assign(FileBelBk,'BelBk.Dat');
{$I-};
Reset(FileBelBk);
{$I+};
End;
Procedure Tambah_Data_Pembelian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBelBk;
If IOResult<>0 Then
Rewrite(FileBelBk);
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('TAMBAH DATA PEMBELIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBelBk)) Do
Begin
Seek(FileBelBk,i);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,15);Write('IDBk "',NOCR,'" Ini Sudah Ada!');
End
Else
Begin
Seek(FileBelBk,Filesize(FileBelBk));
DataBelBk.IDBk:=NOCR;
Gotoxy(20,8);Write('Judul Buku : ');Readln(DataBelBk.JuBk);
Gotoxy(20,10);Write('Pengarang : ');Readln(DataBelBk.Karangan);
Gotoxy(20,12);Write('Penerbit : ');Readln(DataBelBk.Terbitan);
Gotoxy(20,14);Write('Harga : ');Readln(DataBelBk.HargaBk);
Write(FileBelBk,DataBelBk);
End;
Gotoxy(20,17);Write('Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FileBelBk);
End;
Procedure Edit_Data_Pembelian_Buku;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFileBelBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Repeat
Clrscr;
Ada:=False;
i:=0;
Gotoxy(30,2);Write('EDIT DATA PEMBELIAN BUKU');
Gotoxy(30,3);Write('=====================');
Gotoxy(20,6);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBelBk)) Do
Begin
Seek(FileBelBk,i);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk=NOCR Then
Begin
Ada:=True;
Gotoxy(20,8);Write('Judul Buku : ',DataBelBk.JuBk);
Gotoxy(20,10);Write('Pengarang : ',DataBelBk.Karangan);
Gotoxy(20,12);Write('Penerbit : ',DataBelBk.Terbitan);
Gotoxy(20,14);Write('Harga : ',DataBelBk.HargaBk:0:0);
End
Else
Inc(i);
End;
If (Ada=True) Then
Begin
DataBelBk.IDBk:=NOCR;
Gotoxy(20,17);Write('Judul Buku : ');Readln(DataBelBk.JuBk);
Gotoxy(20,19);Write('Pengarang : ');Readln(DataBelBk.Karangan);
Gotoxy(20,21);Write('Penerbit : ');Readln(DataBelBk.Terbitan);
Gotoxy(20,23);Write('Harga : ');Readln(DataBelBk.HargaBk);
Seek(FileBelBk,i);
Write(FileBelBk,DataBelBk);
End
Else
Begin
Gotoxy(20,20);Write('IDBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,24);Write('Mau Edit Data Lagi[Y/T:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FileBelBk);
End;
Procedure Hapus_Data_Pembelian_Buku;
Var
FileTmp : File of BelBk;
Lagi,Hapus: Char;
Ada : Boolean;
i : Integer;
NOCR : Word;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
BukaFileBelBk;
If IOResult<>0 Then
Write('Data Masih Kosong....!')
Else
Begin
Clrscr;
Assign(FileTmp,'belbk.tmp');
Rewrite(FileTmp);
Ada:=False;
i:=0;
Gotoxy(30,4);Write('HAPUS DATA PEMBELIAN BUKU');
Gotoxy(30,6);Write('=====================');
Gotoxy(20,8);Write('ID Buku : ');Readln(NOCR);
While (Ada=False) And (i<>Filesize(FileBelBk)) Do
Begin
Seek(FileBelBk,i);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk=NOCR Then
Ada:=True
Else
Inc(i);
End;
If (Ada=True) Then
Begin
Gotoxy(20,11);Write('Judul Buku : ',DataBelBk.JuBk);
Gotoxy(20,13);Write('Pengarang : ',DataBelBk.Karangan);
Gotoxy(20,15);Write('Penerbit : ',DataBelBk.Terbitan);
Gotoxy(20,17);Write('Harga : ',DataBelBk.HargaBk);
Gotoxy(20,20);Write('Data Ini Mau Di Hapus ? [Y/T] : ');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i := 1 to Filesize(FileBelBk) Do
Begin
Seek(FileBelBk,i-1);
Read(FileBelBk,DataBelBk);
If DataBelBk.IDBk<>NOCR Then
Write(FileTmp,DataBelBk);
End;
Close(FileBelBk);
Assign(FileBelBk,'belbk.Dat');
Erase(FileBelBk);
Assign(FileTmp,'belbk.tmp');
Rename(FileTmp,'belbk.Dat');
Gotoxy(20,23);Write('IDBk "',NOCR,'" Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(20,24);Write('IDBk "',NOCR,'" Ini Tidak Ada!');
End;
Gotoxy(20,25);Write('Mau Hapus Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Procedure Tampil_Data_Pembelian_Buku;
Var
i:Integer;
Begin
Ul:='Y';
BukaFileBelBk;
If IOResult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Clrscr;
Writeln;
Writeln(' DATA TRANSAKSI PEMBELIAN BUKU PERPUSTAKAAN ');
Writeln(' KAMPUS STMIK PALANGKARAYA ');
Writeln;
Writeln('==================================================================================================================');
Writeln(' NO. ID JUDUL NAMA NAMA HARGA');
Writeln(' BUKU BUKU PENGARANG PENERBIT BUKU');
Writeln('==================================================================================================================');
i:=0;
While Not EoF(FileBelBk) Do
Begin
Inc(i);
Read(FileBelBk,DataBelBk);
Writeln(i:2,DataBelBk.IDBk:8,DataBelBk.JuBk:25,DataBelBk.Karangan:27,DataBelBk.Terbitan:29,DataBelBk.HargaBk:23:0);
End;
Writeln('==================================================================================================================');
Close(FileBelBk);
End;
Writeln;
Writeln;
Write('Tekan Tombol Apa Saja Untuk Keluar');Readkey;
End;
Procedure Help;
Begin
Ul:='Y';
Clrscr;
GotoXY(42,4) ; Write('===================================================');
GotoXY(50,5) ; Write('TUTORIAL PENGGUNAAAN APLIKASI INI : ');
GotoXY(42,6) ; Write('===================================================');
GotoXY(32,8) ; Write('1. Saat pertama kali menjalankan aplikasi ini, anda akan masuk pada menu utama.');
GotoXY(32,10); Write('2. Pilihlah salah satu menu program yang ingin anda buka, ');
GotoXY(32,11); Write(' yaitu dengan menekan huruf besar tertentu, (sesuai dengan kode program yang ada)');
GotoXY(32,12); Write(' Contohnya : tekan huruf D (besar) untuk melihat menudaftar data mahasiswa.');
GotoXY(32,14); Write('3. Apabila anda tekan huruf tertentu diluar kode yang ada, maka aplikasi ini');
GotoXY(32,15); Write(' tidak akan merespon, bahkan bisa keluar sendiri, atau tetap pada keadaan semula.');
GotoXY(32,17); Write('4. Pakailah aplikasi ini sebagaimana - mestinya dan secara bijaksana');
GotoXY(32,19); Write('5. Saya mohon maaf apabila menurut anda aplikasi ini masih jauh dari kata sempurna.');
GotoXY(32,20); Write(' Segala komentar, kritik serta saran siap saya terima mengenai aplikasi ini,');
GotoXY(32,21); Write(' agar saya dapat mengembangkan aplikasi ini jauh lebih baik lagi dari sekarang ini.');
GotoXY(42,26); Writeln('===================================================');
GotoXY(57,27); Write('SEKIAN DAN TERIMA KASIH.');
GotoXY(42,28); Writeln('===================================================');
GotoXY(53,31); Write('Tekan Apa Saja Untuk Kembali !!');Readkey
End;
Procedure About;
Begin
Ul:='Y';
Clrscr;
GotoXY(42,4) ; Write('===================================================');
GotoXY(51,5) ; Write('PROGRAM INI TELAH DIBUAT OLEH : ');
GotoXY(42,6) ; Write('===================================================');
GotoXY(49,9) ; Write('Nama : Gamaliel');
GotoXY(49,11); Write('NIM : C1457201006');
GotoXY(49,13); Write('Mata Kuliah : Algoritma & Pemrograman I');
GotoXY(49,15); Write('Jurusan : Sistem Informasi Kelas A');
GotoXY(49,17); Write('Dosen Pengampu : Arliyana S.Kom');
GotoXY(42,22); Writeln('=================================================');
GotoXY(42,23); Write('SEKOLAH TINGGI MANAJEMEN INFORMATIKA DAN KOMPUTER');
GotoXY(57,24); Write('STMIK PALANGKARAYA');
GotoXY(61,25); Write('TAHUN 2014');
GotoXY(42,26); Writeln('=================================================');
GotoXY(50,30); Write('Tekan Apa Saja Untuk Kembali !!');Readkey
End;
Begin
Repeat
Menu_Utama;
Case Pil Of
'A' : Tambah_Data_Anggota;
'B' : Edit_Data_Anggota;
'C' : Hapus_Data_Anggota;
'D' : Tampil_Data_Anggota;
'E' : Cari_Nama_Anggota;
'F' : Tambah_Data_Buku;
'G' : Edit_Data_Buku;
'H' : Hapus_Data_Buku;
'I' : Tampil_Data_Buku;
'J' : Tambah_Data_Pembelian_Buku;
'K' : Edit_Data_Pembelian_Buku;
'L' : Hapus_Data_Pembelian_Buku;
'M' : Tampil_Data_Pembelian_Buku;
'N' : Tambah_Data_Peminjaman_Buku;
'O' : Edit_Data_Peminjaman_Buku;
'P' : Hapus_Data_Peminjaman_Buku;
'Q' : Tampil_Data_Peminjaman_Buku;
'R' : Tambah_Data_Pengembalian_Buku;
'S' : Edit_Data_Pengembalian_Buku;
'T' : Hapus_Data_Pengembalian_Buku;
'U' : Tampil_Data_Pengembalian_Buku;
'W' : Help;
'Y' : About;
End;
Until (Ul<>'Y') Or (Pil='X');
DoneWinCrt;
End.
Rabu, 01 April 2015
Coding Animasi Nama
Program Animasi;
Uses wincrt;
var delay: longint; i: integer;
begin
begin
Gotoxy (8,5);writeln('Nama : Deff Booyy');
Gotoxy (8,6);writeln('Jurusan : Sistem Informasi A');
Gotoxy (8,7);writeln('MK : Algrotitma dan Pemerograman');
end;
{Animasi Bintang 1}
for i:=1 to 65 do
begin
gotoxy(6+i,4);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(71,3+i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 66 do
begin
gotoxy(72-i,22);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(6,23-i);write(chr(42));
for delay:=1 to 1000000 do;
end;
{animasi Bintang 2}
for i:=1 to 70 do
begin
gotoxy(3+i,3);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(73,3+i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 70 do
begin
gotoxy(74-i,23);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(4,23-i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 62 do
begin
gotoxy(7+i,8);write(chr(42));
for delay:=1 to 1000000 do;
end;
begin
for i:= 2 to 72 do
Begin
Gotoxy (8,9);writeln('===================STMIK PALANGKA RAYA=======================');
end;
for i:=1 to 62 do
begin
gotoxy(7+i,10);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 13 do
begin
gotoxy(33,9+i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for delay:=1 to 1000000 do;
end;
begin
for i:= 2 to 72 do
Begin
gotoxy(8,11);write('===================== ');
gotoxy(8,12);write(' ===Defri Siswanto=== ');
gotoxy(8,13);write(' ************ ');
gotoxy(8,14);write(' ********** ');
gotoxy(8,15);write(' ******* ');
gotoxy(8,16);write(' ******* ');
gotoxy(8,17);write(' ********* ');
gotoxy(8,18);write(' *********** ');
gotoxy(8,19);write(' ************* ');
end;
end;
end.
Uses wincrt;
var delay: longint; i: integer;
begin
begin
Gotoxy (8,5);writeln('Nama : Deff Booyy');
Gotoxy (8,6);writeln('Jurusan : Sistem Informasi A');
Gotoxy (8,7);writeln('MK : Algrotitma dan Pemerograman');
end;
{Animasi Bintang 1}
for i:=1 to 65 do
begin
gotoxy(6+i,4);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(71,3+i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 66 do
begin
gotoxy(72-i,22);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(6,23-i);write(chr(42));
for delay:=1 to 1000000 do;
end;
{animasi Bintang 2}
for i:=1 to 70 do
begin
gotoxy(3+i,3);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(73,3+i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 70 do
begin
gotoxy(74-i,23);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 19 do
begin
gotoxy(4,23-i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 62 do
begin
gotoxy(7+i,8);write(chr(42));
for delay:=1 to 1000000 do;
end;
begin
for i:= 2 to 72 do
Begin
Gotoxy (8,9);writeln('===================STMIK PALANGKA RAYA=======================');
end;
for i:=1 to 62 do
begin
gotoxy(7+i,10);write(chr(42));
for delay:=1 to 1000000 do;
end;
for i:=1 to 13 do
begin
gotoxy(33,9+i);write(chr(42));
for delay:=1 to 1000000 do;
end;
for delay:=1 to 1000000 do;
end;
begin
for i:= 2 to 72 do
Begin
gotoxy(8,11);write('===================== ');
gotoxy(8,12);write(' ===Defri Siswanto=== ');
gotoxy(8,13);write(' ************ ');
gotoxy(8,14);write(' ********** ');
gotoxy(8,15);write(' ******* ');
gotoxy(8,16);write(' ******* ');
gotoxy(8,17);write(' ********* ');
gotoxy(8,18);write(' *********** ');
gotoxy(8,19);write(' ************* ');
end;
end;
end.
Selasa, 24 Maret 2015
Coding Pendataan Siswa Baru SMP (Algoritma Pemograman I)
Uses Wincrt;
Type Siswa = Record
Nm : String[15];
Ni : String[14];
TTL : String[25];
Jsk : String [10];
Alm : String [25];
JK :String [10];
Ag:string[10];
SA: string[20];
AS: String[25];
End;
Var
FilePsb : File of Siswa;
Data:Siswa;
Pil,Pilihan,Ul : Char;
Procedure Menu;
begin
Screensize.X := 116 ;
Screensize.Y := 40;
Clrscr;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(36,2);Write('SELAMAT DATANG DI PROGRAM PENDATAAN SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(44,5);Write('===========================');
Gotoxy(52,6);Write('MENU PILIHAN');
Gotoxy(44,7);Write('===========================');
Gotoxy(45,9);Write('(1).TAMBAH DATA SISWA BARU');
Gotoxy(45,11);Write('(2).TAMPIL DATA SISWA BARU');
Gotoxy(45,13);Write('(3).VIEW DATA SISWA BARU');
Gotoxy(45,15);Write('(4).EDIT DATA SISWA BARU');
Gotoxy(45,17);Write('(5).HAPUS DATA');
Gotoxy(45,19);Write('(6).KELUAR');
Gotoxy(44,20);Write('===========================');
Gotoxy(45,21);Write('PILIHAN [1..6] : ');Pil:=Readkey;
End;
Procedure Bukafile;
Begin
Assign(FilePsb,'Psb.Dat');{$i-};
Reset(FilePsb);{$i-};
End;
Procedure Tambah;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: string;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
ReWrite(FilePsb);
Repeat
Clrscr;
Ada:=false;
i:=0;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(50,2);Write('TAMBAH DATA SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(24,4);Write('Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And(i<>Filesize(FilePsb))Do
begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If Data.Ni=NOCR Then
Ada:=True
Else
inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(39,14);Write('NOMOR URUT = ''',NOCR,'''Ini Sudah Ada!');
End
Else
Begin
Seek(FilePsb,Filesize(FilePsb));
Data.Ni:=NOCR;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Lengkap (Sesuai Ijazah) : ');Readln(Data.Nm);
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin(L:Laki-laki dan P:Perempuan) : ');Readln(data.JK);
if(Data.JK='L')or (Data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,11);Write('jenis kelamin anda: ',data.Jsk);
Gotoxy(22,12);write('-----------------------------------------------------------------------------');
Gotoxy(24,13);Write('Agama : ');Readln(data.Ag);
Gotoxy(22,14);write('-----------------------------------------------------------------------------');
Gotoxy(24,15);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(22,16);write('-----------------------------------------------------------------------------');
Gotoxy(24,17);Write('Sekolah Asal : ');Readln(data.Sa);
Gotoxy(22,18);Write('=============================================================================');
Write(FilePsb,Data);
End;
Gotoxy(49,20);Write('Mau Tambah Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FilePsb);
End;
Procedure Tampil;
Var
i:Integer;
Begin
Ul:='Y';
BukaFile;
If IoResult<>0 Then
Write('Maaf Data Masih kosong !')
Else
Begin
Clrscr;
Writeln;
gotoxy(51,1);writeln('_______________');
Gotoxy(50,2);Writeln('[DATA SISWA BARU] ');
Writeln;
Writeln('============-=====================================================================================================');
Writeln('NO| NISN | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JNIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Inc(i);
Read(FilePsb,data);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
writeln('==================================================================================================================');
End;
Close(FilePsb);
End;
Writeln;
Write('Press Any Key To Continue...');Readkey;
End;
Procedure View_NSIN;
Var
i:Integer;
NI:string;
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NI);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Ni=NI Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_Nama;
Var
i:Integer;
Nama:String[17];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nama:');Readln(Nama);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Nm=Nama Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_jsk;
Var
i:Integer;
JSK:String[10];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Jenis Kelamin : ');Readln(jsk);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' DATA SISWA MENURUT JENIS KELAMIN ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.jsk=JSK Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Writeln;
Writeln;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Procedure View;
Var
Pilihan:Char;
Begin
Clrscr;
Gotoxy(48,10);Write('===========================');
Gotoxy(50,11);Write(' VIEW DATA SISWA BARU');
Gotoxy(48,12);Write('===========================');
Gotoxy(48,13);Write(' 1. View Nomor Induk Siswa');
Gotoxy(48,14);Write(' 2. View Nama Siswa');
Gotoxy(48,15);Write(' 3. View Jenis Kelamin');
Gotoxy(48,16);Write('===========================');
Gotoxy(50,17);Write('Pilihan [1..3] : ');Pil:=ReadKey;
if Pil='1'then View_NSIN;
if Pil='2'then View_Nama;
if Pil='3'then View_Jsk;
End;
Procedure edit;
Var
Lagi: char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Bukafile;
If IOResult<>0 Then
Write('Data masih kosong...!')
else
begin
repeat
Clrscr;
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | EDIT DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(24,4);Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Begin
Ada:=True;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------')
End
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Data.Ni:=NOCR;
Gotoxy(51,18);write('__________________');
Gotoxy(50,19);write('| EDIT DATA SISWA |');
Gotoxy(51,20);write('------------------');
Gotoxy(24,21);Write('Nama Siswa : ');Readln(Data.Nm);
Gotoxy(24,22);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(24,23);Write('Jenis Kelamin( L : Laki-laki dan P :Perempuan : ');Readln(data.JK);
if(Data.JK='L')or (data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,24);Write('jenis kelamin anda : ',data.jsk);
Gotoxy(24,25);Write('Agama : ');Readln(data.ag);
Gotoxy(24,26);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(24,27);Write('Sekolah Asal : ');Readln(data.sa);
Write(' ===============================================================================================================');
Seek(FilePsb,i);
Write(FilePsb,Data);
End
Else
Begin
Gotoxy(24,30);Write('NISN''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(24,31);Write('Mau Edit Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FilePsb);
End;
Procedure Hapus;
Var
FileTmp : File of Siswa;
Lagi,Hapus:char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
Bukafile;
If IOResult<>0 Then
Write('data masih kosong...!')
else
Begin
Clrscr;
Assign(FileTmp,'Psb.tmp');
ReWrite(FileTmp);
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | HAPUS DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(22,4);Write('MASUKKAN NOMOR INDUK SISWA : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Ada:=True
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------');
Gotoxy(22,18);Write('Apakah Data Ini Mau Di Hapus ??? [Y/T]:');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i:=1 to filesize(FilePsb) Do
Begin
seek(FilePsb,i-1);
Read(FilePsb,Data);
If Data.Ni<>NOCR Then
Write(FileTmp,Data);
End;
Close(FilePsb);
Assign(FilePsb,'Psb.Dat');
Erase(FilePsb);
Assign(fileTmp,'Psb.tmp');
Rename(FileTmp,'Psb.Dat');
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(22,20);Write('Mau Hapus Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Begin
Repeat
Menu;
Case Pil Of
'1': Tambah;
'2': Tampil;
'3': View;
'4': Edit;
'5': Hapus;
End;
Until(Ul<>'Y') Or (Pil='6');
DoneWincrt;
End.
Type Siswa = Record
Nm : String[15];
Ni : String[14];
TTL : String[25];
Jsk : String [10];
Alm : String [25];
JK :String [10];
Ag:string[10];
SA: string[20];
AS: String[25];
End;
Var
FilePsb : File of Siswa;
Data:Siswa;
Pil,Pilihan,Ul : Char;
Procedure Menu;
begin
Screensize.X := 116 ;
Screensize.Y := 40;
Clrscr;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(36,2);Write('SELAMAT DATANG DI PROGRAM PENDATAAN SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(44,5);Write('===========================');
Gotoxy(52,6);Write('MENU PILIHAN');
Gotoxy(44,7);Write('===========================');
Gotoxy(45,9);Write('(1).TAMBAH DATA SISWA BARU');
Gotoxy(45,11);Write('(2).TAMPIL DATA SISWA BARU');
Gotoxy(45,13);Write('(3).VIEW DATA SISWA BARU');
Gotoxy(45,15);Write('(4).EDIT DATA SISWA BARU');
Gotoxy(45,17);Write('(5).HAPUS DATA');
Gotoxy(45,19);Write('(6).KELUAR');
Gotoxy(44,20);Write('===========================');
Gotoxy(45,21);Write('PILIHAN [1..6] : ');Pil:=Readkey;
End;
Procedure Bukafile;
Begin
Assign(FilePsb,'Psb.Dat');{$i-};
Reset(FilePsb);{$i-};
End;
Procedure Tambah;
Var
Lagi: Char;
Ada : Boolean;
i : Integer;
NOCR: string;
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
BukaFile;
If IOResult<>0 Then
ReWrite(FilePsb);
Repeat
Clrscr;
Ada:=false;
i:=0;
Gotoxy(22,1);Write('=============================================================================');
Gotoxy(50,2);Write('TAMBAH DATA SISWA BARU | ');
Gotoxy(22,3);Write('=============================================================================');
Gotoxy(22,2);writeln('|');
Gotoxy(24,4);Write('Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And(i<>Filesize(FilePsb))Do
begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If Data.Ni=NOCR Then
Ada:=True
Else
inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(39,14);Write('NOMOR URUT = ''',NOCR,'''Ini Sudah Ada!');
End
Else
Begin
Seek(FilePsb,Filesize(FilePsb));
Data.Ni:=NOCR;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Lengkap (Sesuai Ijazah) : ');Readln(Data.Nm);
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin(L:Laki-laki dan P:Perempuan) : ');Readln(data.JK);
if(Data.JK='L')or (Data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,11);Write('jenis kelamin anda: ',data.Jsk);
Gotoxy(22,12);write('-----------------------------------------------------------------------------');
Gotoxy(24,13);Write('Agama : ');Readln(data.Ag);
Gotoxy(22,14);write('-----------------------------------------------------------------------------');
Gotoxy(24,15);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(22,16);write('-----------------------------------------------------------------------------');
Gotoxy(24,17);Write('Sekolah Asal : ');Readln(data.Sa);
Gotoxy(22,18);Write('=============================================================================');
Write(FilePsb,Data);
End;
Gotoxy(49,20);Write('Mau Tambah Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
Close(FilePsb);
End;
Procedure Tampil;
Var
i:Integer;
Begin
Ul:='Y';
BukaFile;
If IoResult<>0 Then
Write('Maaf Data Masih kosong !')
Else
Begin
Clrscr;
Writeln;
gotoxy(51,1);writeln('_______________');
Gotoxy(50,2);Writeln('[DATA SISWA BARU] ');
Writeln;
Writeln('============-=====================================================================================================');
Writeln('NO| NISN | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JNIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Inc(i);
Read(FilePsb,data);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
writeln('==================================================================================================================');
End;
Close(FilePsb);
End;
Writeln;
Write('Press Any Key To Continue...');Readkey;
End;
Procedure View_NSIN;
Var
i:Integer;
NI:string;
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NI);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Ni=NI Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_Nama;
Var
i:Integer;
Nama:String[17];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Masukkan Nama:');Readln(Nama);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' [DATA SISWA MENURUT NOMOR IJAZAH] ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.Nm=Nama Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
procedure View_jsk;
Var
i:Integer;
JSK:String[10];
Lagi:Char;
Begin
Ul:='Y';
Lagi:='Y';
Repeat;
Clrscr;
Write('Jenis Kelamin : ');Readln(jsk);
Bukafile;
If Ioresult<>0 Then
Write('Maaf Data Masih Kosong !')
Else
Begin
Writeln;
Writeln;
Writeln(' DATA SISWA MENURUT JENIS KELAMIN ');
Writeln('============-=====================================================================================================');
Writeln('NO| NOMOR IJAZAH | NAMA LENGKAP | TEMPAT TANGGAL LAHIR | JENIS KELAMIN | AGAMA | ALAMAT SISWA | SEKOLAH ASAl');
Writeln('==================================================================================================================');
i:=0;
While Not Eof(FilePsb) Do
Begin
Read(FilePsb,Data);
If Data.jsk=JSK Then
Begin
Inc(i);
Writeln(i:1,'.|',data.Ni:11,' ',Data.Nm:16,' ',Data.TTL:25,' ',Data.jsk:11,' ',Data.Ag:9,' ',Data.Alm:18,' ',Data.Sa:11);
End;
End;
Writeln('==================================================================================================================');
Close(FilePsb);
End;
Writeln;
Writeln;
Writeln;
Writeln;
Write('Mau Lihat Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Procedure View;
Var
Pilihan:Char;
Begin
Clrscr;
Gotoxy(48,10);Write('===========================');
Gotoxy(50,11);Write(' VIEW DATA SISWA BARU');
Gotoxy(48,12);Write('===========================');
Gotoxy(48,13);Write(' 1. View Nomor Induk Siswa');
Gotoxy(48,14);Write(' 2. View Nama Siswa');
Gotoxy(48,15);Write(' 3. View Jenis Kelamin');
Gotoxy(48,16);Write('===========================');
Gotoxy(50,17);Write('Pilihan [1..3] : ');Pil:=ReadKey;
if Pil='1'then View_NSIN;
if Pil='2'then View_Nama;
if Pil='3'then View_Jsk;
End;
Procedure edit;
Var
Lagi: char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Bukafile;
If IOResult<>0 Then
Write('Data masih kosong...!')
else
begin
repeat
Clrscr;
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | EDIT DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(24,4);Write('Masukkan Nomor Induk Siswa Nasional : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Begin
Ada:=True;
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------')
End
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Data.Ni:=NOCR;
Gotoxy(51,18);write('__________________');
Gotoxy(50,19);write('| EDIT DATA SISWA |');
Gotoxy(51,20);write('------------------');
Gotoxy(24,21);Write('Nama Siswa : ');Readln(Data.Nm);
Gotoxy(24,22);Write('Tempat,Tanggal Lahir : ');Readln(data.TTL);
Gotoxy(24,23);Write('Jenis Kelamin( L : Laki-laki dan P :Perempuan : ');Readln(data.JK);
if(Data.JK='L')or (data.JK='l') then
Data.Jsk:='Laki-laki'
else
if(Data.JK='P')or (data.JK='p') then
Data.Jsk:='Perempuan'
else
data.Jsk:='Tidak ada';
Gotoxy(24,24);Write('jenis kelamin anda : ',data.jsk);
Gotoxy(24,25);Write('Agama : ');Readln(data.ag);
Gotoxy(24,26);Write('Alamat Lengkap : ');Readln(data.alm);
Gotoxy(24,27);Write('Sekolah Asal : ');Readln(data.sa);
Write(' ===============================================================================================================');
Seek(FilePsb,i);
Write(FilePsb,Data);
End
Else
Begin
Gotoxy(24,30);Write('NISN''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(24,31);Write('Mau Edit Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
Until Lagi<>'Y';
End;
Close(FilePsb);
End;
Procedure Hapus;
Var
FileTmp : File of Siswa;
Lagi,Hapus:char;
Ada : Boolean;
i : Integer;
NOCR: String[14];
Begin
Ul:='Y';
Lagi:='Y';
Clrscr;
Repeat
Bukafile;
If IOResult<>0 Then
Write('data masih kosong...!')
else
Begin
Clrscr;
Assign(FileTmp,'Psb.tmp');
ReWrite(FileTmp);
Ada:=False;
i:=0;
Writeln(' =================================================================================================================');
Writeln(' | HAPUS DATA SISWA |');
Writeln(' =================================================================================================================');
Gotoxy(22,4);Write('MASUKKAN NOMOR INDUK SISWA : ');Readln(NOCR);
While(Ada=False) And (i<>Filesize(FilePsb)) Do
Begin
Seek(FilePsb,i);
Read(FilePsb,Data);
If data.Ni=NOCR Then
Ada:=True
Else
Inc(i);
End;
If(Ada=True) Then
Begin
Gotoxy(22,5);write('-----------------------------------------------------------------------------');
Gotoxy(24,6);Write('Nama Siswa : ',Data.Nm);
Gotoxy(22,7);write('-----------------------------------------------------------------------------');
Gotoxy(24,8);Write('Tempat,Tanggal Lahir : ',data.TTL);
Gotoxy(22,9);write('-----------------------------------------------------------------------------');
Gotoxy(24,10);Write('Jenis Kelamin : ',data.Jsk);
Gotoxy(22,11);write('-----------------------------------------------------------------------------');
Gotoxy(24,12);Write('Agamat : ',data.ag);
Gotoxy(22,13);write('-----------------------------------------------------------------------------');
Gotoxy(24,14);Write('Alamat : ',data.alm);
Gotoxy(22,15);write('-----------------------------------------------------------------------------');
Gotoxy(24,16);Write('Sekolah Asal : ',data.sa);
Gotoxy(22,17);write('-----------------------------------------------------------------------------');
Gotoxy(22,18);Write('Apakah Data Ini Mau Di Hapus ??? [Y/T]:');Readln(Hapus);
If Upcase(Hapus)='Y' Then
Begin
For i:=1 to filesize(FilePsb) Do
Begin
seek(FilePsb,i-1);
Read(FilePsb,Data);
If Data.Ni<>NOCR Then
Write(FileTmp,Data);
End;
Close(FilePsb);
Assign(FilePsb,'Psb.Dat');
Erase(FilePsb);
Assign(fileTmp,'Psb.tmp');
Rename(FileTmp,'Psb.Dat');
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Sudah Di Hapus!');
End;
End
Else
Begin
Gotoxy(22,19);Write('NOMOR INDUK SISWA''',NOCR,'''Ini Tidak Ada!');
End;
Gotoxy(22,20);Write('Mau Hapus Data Lagi[Y/T]:');Lagi:=Upcase(Readkey);
End;
Until Lagi<>'Y';
End;
Begin
Repeat
Menu;
Case Pil Of
'1': Tambah;
'2': Tampil;
'3': View;
'4': Edit;
'5': Hapus;
End;
Until(Ul<>'Y') Or (Pil='6');
DoneWincrt;
End.