Program KHS Mahasiswa

program record_data_mahasiswa;
uses crt;
const nMaks = 100;
Mn = 10;

Type
     matakuliah = record
         kodemk : string[8];
         namamk : string[20];
            sks : integer;
         nilai  : integer;
      sksxnilai : integer;
end;

      mahasiswa = record
             mk : array[1..Mn] of matakuliah;
            NIM : string[15];
       nama : string[20];
       skstotal : integer;
      nilaitotal: integer;
             ip : real;
        nextsks : string[8];

end;

var
         TabMhs : array[1..nMaks] of mahasiswa;
     I, J, M, N : integer;
         nilaiN : integer;
         nilaiH : string[2];
         tambah : char;

procedure konversinilaiH;
begin
     if TabMhs[I].mk[J].nilai > 80 then nilaiH := 'A'
else if(TabMhs[I].mk[J].nilai >=70)and(TabMhs[I].mk[J].nilai <=80)then nilaiH := 'B'
else if(TabMhs[I].mk[J].nilai >=50)and(TabMhs[I].mk[J].nilai <=69)then nilaiH := 'C'
else if(TabMhs[I].mk[J].nilai >=40)and(TabMhs[I].mk[J].nilai <=59)then nilaiH := 'D'
else                                                                   nilaiH := 'E'
end;

procedure konversinilaiN;
begin
     if NilaiH = 'A' then nilaiN := 4
else if nilaiH = 'B' then nilaiN := 3
else if nilaiH = 'C' then nilaiN := 2
else if nilaiH = 'D' then nilaiN := 1
else                      nilaiN := 0
end;

procedure ambilsks;
begin
     if TabMhs[I].ip >= 3.00                              then TabMhs[I].nextsks := '22 - 24'
else if (TabMhs[I].ip <= 2.99) and (TabMhs[I].ip >= 2.50) then TabMhs[I].nextsks := '22 - 24'
else if (TabMhs[I].ip <= 2.49) and (TabMhs[I].ip >= 2.00) then TabMhs[I].nextsks := '20 - 22'
else if (TabMhs[I].ip <= 1.99) and (TabMhs[I].ip >= 1.50) then TabMhs[I].nextsks := '18 - 20'
else if  TabMhs[I].ip <  1.50                             then TabMhs[I].nextsks := '16 - 18'
end;

procedure tampildata;
begin
for I:= 1 to N do
begin
writeln ('                    Kartu Hasil Studi    ');
writeln ('                 ------------------------');
writeln ('                                         ');
writeln ('                 ------------------------');
writeln ('                                         ');
writeln ('                 ------------------------');
writeln('=====================================================================');
writeln('Nama Mahasiswa : ',TabMhs[I].nama);
writeln('NRP Mahasiswa  : ',TabMhs[I].NIM);
writeln('---------------------------------------------------------------------');
writeln('No |Kode MK   |Nama Mata Kuliah   |Nilai|Nilai|Nilai|SKS|SKS x Nilai ');
writeln('                                  |  MK |  H  |  N  |   |      Angka ');
writeln('---------------------------------------------------------------------');

for J := 1 to M do
begin
konversinilaiH;
konversinilaiN;

TabMhs[I].mk[J].sksxnilai := nilaiN * TabMhs[I].mk[J].sks;
writeln(J:1,TabMhs[I].mk[J].kodemk:11,TabMhs[I].mk[J].namamk:19,
TabMhs[I].mk[J].nilai:7,nilaiH:6,nilaiN:6,
TabMhs[I].mk[J].sks:5,TabMhs[I].mk[J].sksxnilai:8);

TabMhs[I].skstotal   := TabMhs[I].skstotal + TabMhs[I].mk[J].sks;
TabMhs[I].nilaitotal := TabMhs[I].nilaitotal + TabMhs[I].mk[J].sksxnilai;

end;

writeln('---------------------------------------------------------------------');
writeln('                TOTA L           ',TabMhs[I].skstotal:22,TabMhs[I].nilaitotal:8);
writeln('---------------------------------------------------------------------');

TabMhs[I].ip := TabMhs[I].nilaitotal / TabMhs[I].skstotal;

writeln('IP Semester = ',TabMhs[I].nilaitotal,'/',TabMhs[I].skstotal,' = ',TabMhs[I].ip:0:2);

ambilsks;
writeln('SKS yang dapat diambil semester berikutnya = ',TabMhs[I].nextsks);
writeln;
end;
end;

procedure bacadata;
begin
for I := 1 to N do
begin
write('NRP Mahasiswa ke-',I,'       = ');readln(TabMhs[I].NIM);
write('Nama Mahasiswa ke-',I,'      = ');readln(TabMhs[I].nama);
write('Jumlah Mata Kuliah       = ');readln(M);
writeln('--------------------------------------------------');

for J := 1 to M do
begin
write('Kode Matakuliah ke  -',J,'   = ');readln(TabMhs[I].mk[J].kodemk);
write('Nama Matakuliah          = ');readln(TabMhs[I].mk[J].namamk);
write('SKS Matakuliah           = ');readln(TabMhs[I].mk[J].sks);
write('nilai Matakuliah         = ');readln(TabMhs[I].mk[J].nilai);
writeln('--------------------------------------------------');
end;
end;
end;

begin
write('Masukkan Jumlah Data Mahasiswa = ');readln(N);

Repeat
clrscr;
bacadata;

clrscr;
tampildata;
write ('Anda Ingin Memasukkan Data Mahasiswa Lagi? [Y/N] (maaf, koment repeat gagal,');
write ('anda bisa perbaikinya sendiri) : ');readln(tambah);
tambah := Upcase(tambah);
until (tambah <> 'Y');
end.

Post a Comment

[blogger]

Author Name

Contact Form

Name

Email *

Message *

Powered by Blogger.