Minggu, Februari 07, 2010

Tugas1, Rekayasa Perangkat Lunak kelas X....

Tugas pemograman pascal, dikumpulkan dalam bentuk soft copy, paling lambat 05 Maret 2010
Buat program dengan bahasa pemograman pascal untuk data penjualan tiket "
Agen Bus Malam Antar Kota "Lorenza"" dengan hasil output sbb:



GOOG LUCK :-)


uses crt;

const

h=50000;

var

np,jrs:array[1..8] of string;

jb,jp:array[1..8] of real;

hg:array[1..8] of longint;

kls:array[1..8] of integer;

i,n,j:integer;

tp:real;

begin

clrscr;

write('Masukan Jumlah Penumpang : ');readln(n);

for i:=1 to n do

begin

clrscr;

writeln('Data Ke- ',i,':' );

write('Nama Penumpang :');readln(np[i]);

write('Jurusan :');readln(jrs[i]);

write('Kelas [1/2/3] :');readln(kls[i]);

write('Jumlah Beli :');readln(jb[i]);

(*Struktur IF*)

if kls[i]=1 then

begin

hg[i]:=150000;

jp[i]:=jb[i]*hg[i];

end

else if kls[i]=2 then

begin

hg[i]:=100000;

jp[i]:=jb[i]*hg[i];

end

else if kls[i]=3 then

begin

hg[i]:=50000;

jp[i]:=jb[i]*hg[i];

end

else

begin

hg[i]:=0;

jp[i]:=jb[i]*hg[i];

end;

(*Case Of*)

(*case kls[i] of

1:begin

hg[i]:=150000;

jp[i]:=jb[i]*hg[i];

end;

2:begin

hg[i]:=100000;

jp[i]:=jb[i]*hg[i];

end;

3:begin

hg[i]:=50000;

jp[i]:=jb[i]*hg[i];

end;

else

begin

jp[i]:=0;

end;

end;*)

(*jp[i]:=h*jb[i];*)

tp:=0;

end;

(*for j:=1 to n do

begin

tp:=jp[i]+tp;

end;*)

writeln;

writeln('Data Penjualan Tiket');

Writeln('Agen Bus Malam Antar Kota "Lorenza"');

writeln;

writeln('------------------------------------------------');

writeln('No Nama Penumpang Jurusan Kelas Jumlah Beli Jumlah Pembayaran');

writeln('------------------------------------------------');

for i:=1 to n do

begin

writeln(' ', i , ' ',np[i]:5,jrs[i]:18,kls[i]:5,jb[i]:15:0,jp[i]:15:2);

tp:=jp[i]+tp;

end;

writeln('------------------------------------------------');

writeln('Total Pembayaran Rp',tp:7:2);

writeln('------------------------------------------------');

readln

end.