Program Hitung Nilai Mahasiswa dengan Pascal

program data_mahasiswa;
uses crt;

type
mahasiswa=record
nim:string;
nama:string;
presnsi,uas,uts,tugas:integer;
nilai:real;
grade:char;
end;

var
mhs:array [1..10] of mahasiswa;
i,j,x:integer;
jml:integer;
kode_mk:integer;
nama_mk:string;
begin
clrscr;
j:=0;
writeln(‘=====================================’);
writeln(‘       PROGRAM HITUNG NILAI          ‘);
writeln(‘=====================================’);
write(‘Masukan Jumlah Data     : ‘);readln(jml);
write(‘Masukan Kode Matakuliah : ‘);readln(kode_mk);
writeln;
if kode_mk =151 then
begin
nama_mk:=’Algoritma & Pemograman’;
end
else
if kode_mk=422 then
begin
nama_mk:=’Linux 1′;
end
else
if kode_mk=733 then
begin
nama_mk:=’PPN II (Access)’;
end
else
if kode_mk=772 then
begin
nama_mk:=’DBMS’;
end
else
begin
nama_mk:=”;
end;

if jml>10 then
begin
writeln(‘Melebihi Kapasitas’);
end
else
begin
for i:=1 to jml do
begin
with mhs[i] do
begin
write(‘Nilai ke- ‘,i,’ dari ‘,jml);writeln;
write(‘NIM           : ‘);readln(nim);
write(‘Nama          : ‘);readln(nama);
write(‘Nilai Presensi: ‘);readln(presnsi);
write(‘Nilai UTS     : ‘);readln(uts);
write(‘Nilai UAS     : ‘);readln(uas);
write(‘Nilai Tugas   : ‘);readln(tugas);
writeln;
writeln;
writeln;
nilai:=(20/100*tugas)+(20/100*uts)+(10/100*presnsi)+(50/100*uas);
if nilai >= 80 then
begin
grade:=’A’;
j:=j+1;
end
else
if (nilai <=79) and (nilai>=70) then
begin
grade:=’B’;
j:=j+1;
end
else
if (nilai <=69) and (nilai>=60) then
begin
grade:=’C’;
j:=j+1;
end
else
if (nilai <=59) and (nilai>=50) then
begin
grade:=’D’;
x:=x+1;
end
else
begin
grade:=’E’;
x:=x+1;
end;
end;
end;
writeln(‘Kode Mata Kuliah : ‘,kode_mk);
writeln(‘Mata Kuliah      : ‘,nama_mk);
writeln;
writeln(‘===============================================================================’);
writeln(‘NIM’:10,’Nama’:15,’Presensi’:10,’UTS’:7,’UAS’:7,’Tugas’:8,’Nilai’:10,’Grade’:10);
writeln(”:10,’Mhs’:15,”:10,”:7,”:7,”:8,”:10,”:10);
writeln(‘===============================================================================’);
for i:=1 to jml do
begin
with mhs[i] do
begin
writeln(nim:10,nama:15,presnsi:10,uts:7,uas:7,tugas:8,nilai:10:2,grade:10);
end;
end;
end;
writeln(‘===============================================================================’);
writeln;
write(‘                                Jumlah Mahasiswa Yang Lulus Adalah        : ‘,j);
writeln;
write(‘                                Jumlah Mahasiswa Yang tidak lulus Adalah  : ‘,x);
readln;
end.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s