Program mandiri Bag. (2)

oleh : 
arif zainurrohman
danni setiadi
sepdia mautia putri



IV.         PROGRAM
Program Data_ProMan;
Uses winCrt ;
const
     garis1 = '--------------------------------------------------------------------------------';
     garis2 = '================================================================================';
     garsed1= '--------------------------------------------------------------------';
     garsed2= '====================================================================';
     gar2 = '====================================';
     gar1 = '------------------------------------';
     gar3 = '==========================';
     garspas= ' ====================================================================';
     spasi  = ' ';
     spasi2 = ' ';
     teks1 = 'PROGRAM MANDIRI KARAOKE';
     teks2 = '    ARDASEP KARAOKE  ';
     teks3 = '2012';

Type
    karaoke  = Record
    Kdmember : word;
    nama     : String[20];
End;

type
    tempat    = record
    kdruang   : word;
    jenis     : string[10];
    status    : string[10];
    kapasitas : string[10];
end;

Type
    waktu = record
    Jam   : integer;
end;

Var
   Filekaraoke        : File of karaoke;
   Filetempat         : file of tempat;
   Data               : karaoke;
   Data1              : tempat;
   nama               : string;
   j                  : array[0..3]of waktu;
   harga1,harga2,pajak,potongan,total,ubay,ukem:real;
   jenru              : string[10];
   Pil,pul,pal,pel,pol: Char;
   x,y,i              : integer;

Procedure Title;
begin
     gotoxy(27,1); writeln(teks1);
     gotoxy(28,2); writeln(teks2);
     gotoxy(38,3); writeln(teks3);
     gotoxy(1,4); writeln(garis2);
end;
Procedure Menu;
Begin
     Clrscr;
     title;
     x:=30; y:=6;
     Gotoxy(35,y);Write('MENU UTAMA');
     Gotoxy(34,y+1);Write('============');
     Gotoxy(x,y+2);Write('1. MENU PENGURUSAN ANGGOTA');
     Gotoxy(x,y+3);Write('2. MENU PENGURUSAN RUANGAN');
     Gotoxy(x,y+4);Write('3. PELANGGAN');
     Gotoxy(x,y+5);Write('4. KELUAR PROGRAM');
     Gotoxy(32,y+6);Write('Pilihan [1..4]: ');Pil:=Readkey;
End;

Procedure BukaFile;
Begin
     Assign(Filekaraoke,'karaoke.txt');
{$I+}
     Reset(Filekaraoke);
{$I-}
end;
Procedure Buka;
begin
     Assign(Filetempat,'tempat.txt');
{$I+}
     Reset(Filetempat);
{$I-}
End;

Procedure Akhir;
var
   lagi:char;
Begin
     clrscr;
     Gotoxy(30,10);
     Write(' PROGRAM MANDIRI ');
     Gotoxy(0,12);
     Write('<<<<<==================================================================== >>>>>');
     Gotoxy(5,14);
     Write('Created by Arif Zainurrohman , Danni Setiadi , dan Sepdia Mautia Putri');
     Gotoxy(5,16);
     Write(' Tekan Kombinasi Alt + F4 Untuk Keluar Program');
     Gotoxy(10,80);
     Write('Apakah Anda Mau Masuk Program Lagi (Y/T) : ');readln(lagi);
     if lagi='y' then
        begin
             Menu;
     end;
end;

Procedure Tambah;
Var
   Lagi: Char;
   Ada : Boolean;
   i   : Integer;
   NOCR: Word;
label satu;

Begin
     Lagi:='Y';
     Clrscr;
     BukaFile;
     If IOResult = 0 Then
        Repeat
              Clrscr;
              title;
              Ada:=False;
              i:=0;
              x:=28;y:=5;
              Gotoxy(x+4,y);Write('TAMBAH MEMBER ');
              Gotoxy(x+4,y+1);Write('----------------');
              Gotoxy(x,y+2);Write('Kode Member : ');Readln(NOCR);
              While (Ada=False) And (i<>Filesize(Filekaraoke)) Do
                    Begin
Seek(Filekaraoke,i);
                         Read(Filekaraoke,Data);
If Data.Kdmember=NOCR Then
Ada:=True
                         Else
                             Inc(i);
                         End;
                         If (Ada=True) Then
                            Begin
                                 Gotoxy(x-5,y+7);Write('Kode Member ',NOCR,' Ini Sudah ada!');
                            End
                         Else
                             Begin
                                  Seek(Filekaraoke,Filesize(Filekaraoke));
                                  Data.Kdmember:=NOCR;
                                  satu:
Gotoxy(X,y+3);Write('Nama : ');Readln(Data.nama);
                                  if (Data.nama='') then
                                     goto satu;
                                     Write(Filekaraoke,Data);
                                  End;
                                     Gotoxy(x-5,y+8);Write('Apakah Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
        Until Lagi<>'Y';
              Close(Filekaraoke);
End;

Procedure Tambah1;
Var
   Lagi : Char;
   Ada : Boolean;
   i : Integer;
   NOCR :word;
label dua;

begin
     Lagi :='Y';
     Clrscr;
     Buka;
     If IOResult=0 Then
        Repeat
              Clrscr;
              title;
              Ada:=False;
              i:=0;
x:=28;y:=5;
              Gotoxy(x+4,y);Write('TAMBAH DATA RUANGAN ');
              Gotoxy(x+4,y+1);Write('----------------');
              Gotoxy(x,y+2);Write('Kode Ruangan : ');Readln(NOCR);
              While (Ada=False) And (i<>Filesize(Filetempat)) Do
                    Begin                        
  Seek(Filetempat,i);
                         Read(Filetempat,Data1);
                         If Data1.Kdruang = NOCR Then
                            Ada:=True
                         Else
                             Inc(i);
                         End;
                             If (Ada=True) Then
                             Begin
                                  Gotoxy(x-5,y+7);Write('Kode Ruangan ',NOCR,' Ini Sudah ada!');
                             End
                             Else
                                 Begin
                                      Seek(Filetempat,Filesize(Filetempat));
                                      Data1.Kdruang:=NOCR;
                                      dua:
 Gotoxy(X,y+3);Write('Jenis Ruangan : ');Readln(Data1.jenis);
                                      Gotoxy(X,y+4);Write('Status Ruangan : ');Readln(Data1.status);
                                      Gotoxy(X,y+5);write('Kapasitas orang :');readln(Data1.kapasitas);
                                      if (Data1.jenis='') or (Data1.status='') or (Data1.kapasitas='') then
                                         goto dua;
                                              Write(Filetempat,Data1);
              End;
              Gotoxy(x-5,y+8);Write('Apakah Mau Tambah Data Lagi [Y/T]:');Lagi:=Upcase(Readkey);
        Until Lagi<>'Y';
Close(Filetempat);
End;

Procedure Edit;
Var
   Lagi : Char;
   Ada  : Boolean;
   i    : Integer;
   NOCR : Word;
   NOCK  :string;
label tiga;

Begin
     Lagi:='Y';
     Clrscr;
     title;
     Buka;
     If IOResult <> 0 Then
Write('Data Masih Kosong...!')
     Else
     Begin
Repeat
    Clrscr;
                title;
                Ada:=False;
                i:=0;
                x:=31;y:=6;
                Gotoxy(x+2,y);Write('UBAH STATUS RUANGAN');
                Gotoxy(x+1,y+1);Write('----------------');
                Gotoxy(x+4,y+2);Write('Kode Ruangan : ');Readln(NOCR);
                Gotoxy(x+4,y+3);Write('Jenis Ruangan : ');Readln(NOCK);
                While (Ada=False) And (i<>Filesize(Filetempat)) Do
                      Begin
                           Seek(Filetempat,i);
                           Read(Filetempat,Data1);
                           If (Data1.Kdruang=NOCR) and (Data1.jenis=NOCK) Then
                              Begin
                                   Ada:=True;
                                   x:=16;y:=7;
                                   gotoxy(X+20,y+3);write('SEBELUM SESUDAH');
                                   gotoxy(x+20,y+4);write('------- -------');
                                   Gotoxy(X,y+5);Write('Status Ruangan : ');writeln(Data1.status);




Ibu Kota , 10 Oktober 2013

akhukum fillah arif zainurrohman

0 komentar:

Posting Komentar