Sabtu, 02 Juli 2011

Jawaban soal Quis No.4

uses crt;
type
  Dosen = record
    kode  : string[3];
    nama  : string;
    pen   : string;
    kea     : string;
end;
  Mahasiswa= Record
    NPM        : string[7];
    NAMA       : string[15];
    jen,jur    : string[15];
    thn        : string;
end;
var
   rDos       : array[1..25] of Dosen;
   rMah       : array[1..15] of Mahasiswa;
   i,j        : byte;
   Pil, lg    : char;
procedure InputDosen;
   Procedure FormDosen;
   begin
    clrscr;
    gotoxy(13,3); write('INPUT DATA DOSEN');
    gotoxy(5,4); write('_____________________________');
    gotoxy(5,5); write('Kode Dosen     :');
    gotoxy(5,6); write('NAMA           :');
    gotoxy(5,7); write('Pendidikan     :');
    gotoxy(5,8); write('Keahlian       :');
    gotoxy(5,9); write('_____________________________');
    gotoxy(5,10); write('isikan data lagi [Y/T]:');
end;
begin
    repeat
        Formdosen;
        with Rdos[i] do
        begin
    gotoxy(22,5); readln(kode);
    gotoxy(22,6); readln(Nama);
    gotoxy(22,7); readln(pen);
    gotoxy(22,8); readln(kea);
    gotoxy(29,10); readln(lg);
    inc(i);
    end;
    until upcase(lg)='T';
end;
procedure InputMahasiswa;
   Procedure FormMahasiswa;
   begin
    clrscr;
    gotoxy(13,3); write('INPUT DATA MAHASISWA');
    gotoxy(5,4); write('_____________________________');
    gotoxy(5,5); write('NPM            :');
    gotoxy(5,6); write('NAMA           :');
    gotoxy(5,7); write('Jenjang        :');
    gotoxy(5,8); write('Jurusan        :');
    gotoxy(5,9); write('Tahun          :');
    gotoxy(5,10); write('_____________________________');
    gotoxy(5,11); write('isikan data lagi [Y/T]:');
end;
begin
    repeat
        FormMahasiswa;
        with Rmah[i] do
        begin
    gotoxy(22,5); readln(NPM);
    gotoxy(22,6); readln(NAMA);
    gotoxy(22,7); readln(jen);
    gotoxy(22,8); readln(jur);
    gotoxy(22,9); readln(thn);
    gotoxy(29,11); readln(lg);
    inc(i);
    end;
    until upcase(lg)='T';
end;
Procedure OutputDosen;
  Procedure TabelDosen;
  begin
   clrscr;
   gotoxy(10,4); write('                INPUT DATA DOSEN');
   gotoxy(3,5); write('___________________________________________________');
   gotoxy(3,6); write('  NO  Kode  Nama           Pendidikan   Keahlian');
   gotoxy(3,7); write('---------------------------------------------------');
end;
begin
   TabelDosen;
   for j:=1 to I-1 do
   begin
        with RDos[j] do
        begin
        gotoxy(5,7+j); write(j:1,'  ',kode:4);
        gotoxy(15,7+j); write(nama);
        gotoxy(30,7+j); write(pen);
        gotoxy(43,7+j); write(kea);
        end;
     end;
     gotoxy(3,9+j); write('___________________________________________________');
     repeat until keypressed;
end;
Procedure OutputMahasiswa;
  Procedure TabelMahasiswa;
  begin
   clrscr;
   gotoxy(10,4); write('                INPUT DATA MAHASISWA');
   gotoxy(3,5); write('____________________________________________________________________________');
   gotoxy(3,6); write('  NO  NPM       NAMA        Jenjang     Jurusan     Tahun');
   gotoxy(3,7); write('----------------------------------------------------------------------------');
end;
begin
   TabelMahasiswa;
   for j:=1 to I-1 do
   begin
        with RMah[j] do
        begin
        gotoxy(5,7+j); write(j:0,'  ',NPM:8,'  ',NAMA);
        gotoxy(33,7+j); write(jen);
        gotoxy(44,7+j); write(jur);
        gotoxy(56,7+j); write(thn);
        end;
     end;
     gotoxy(3,7+j); write('_____________________________________________________________________________');
     repeat until keypressed;
end;
procedure menu;
begin
     clrscr;
     gotoxy(20,2); write('MENU PEGAWAI');
     gotoxy(10,3); write('_________________________________________');
     gotoxy(10,4); write('[1]. Input Data Dosen');
     gotoxy(10,5); write('[2]. Input Data Mahasiswa');
     gotoxy(10,6); write('[3]. Output data Dosen');
     gotoxy(10,7); write('[4]. Output data Mahasiswa');
     gotoxy(10,8); write('[5]. Keluar Program');
     gotoxy(10,9); write('__________________________________________');
     gotoxy(10,10); write('Pilihan    :');
end;
begin{Program Utama}
i:=1; Pil:='1';
while Pil<>'5' do
begin
     menu;
     pil:=readkey;
     case Pil of
     '1': InputDosen;
     '2': InputMahasiswa;
     '3': OutputDosen;
     '4': OutputMahasiswa;
end;
end;
end.
Ini adalah tampilan hasil programnya setelah di Ctrl+F9

Tidak ada komentar:

Posting Komentar