2
PROGRAM PASCAL (RENTAL MOBIL)
Posted by Unknown
on
05.42
Program rental_mobil;
Uses Wincrt;
Type rntl_mobil = record
no, tgl, nama, nm_mbil,almt,hp : String;
kd_mbil, lm_rtl : byte;
hrg, tot : real;
End;
Var
Data : Array [1..10] of rntl_mobil;
lagi : Char;
a,n, x : Integer;
tot_slrh : real;
Begin
Repeat
Clrscr;
a:=a+1;
Writeln(' ANUGRAH SENTOSA ');
Writeln(' Jl.Maju Terus no.7 Ciawi Tasikmalaya ');
Writeln('========================================');
Writeln;
writeln(' "RENTAL MOBIL" ');
Writeln;
Write('No : ');Readln(Data[a].no);
Write('Tanggal : ');Readln(Data[a].tgl);
Write('Nama Pelanggan : ');Readln(Data[a].nama);
Write('Alamat : ');Readln(Data[a].almt);
Write('No Hp : ');Readln(Data[a].hp);
writeln('STOK MOBIL:');
writeln('"001" (FERARRI)');
writeln('"002" (JAZZ)');
writeln('"003" (AVANZA)');
Write('Masukan Kode Mobil : ');Readln(Data[a].kd_mbil);
if Data[a].kd_mbil = 001 then
begin
Data[a].nm_mbil:='FERARRI';
Data[a].hrg:=3000000;
end;
if Data[a].kd_mbil = 002 then
begin
Data[a].nm_mbil:='JAZZ';
Data[a].hrg:=1000000;
end;
if Data[a].kd_mbil = 003 then
begin
Data[a].nm_mbil:='AVANZA';
Data[a].hrg:=500000;
end;
Writeln('Nama Mobil : ',Data[a].nm_mbil);
Writeln('Harga Per Hari : ',Data[a].hrg:0:0);
Write('Lama Rental : ');Readln(Data[a].lm_rtl);
Data[a].tot:=Data[a].lm_rtl*Data[a].hrg;
writeln('Total Bayar : ',Data[a].tot:0:0);
Writeln;
write('Tambah Data (y/t) : ');readln(lagi);
until lagi <> 'y';
n:=a;
Clrscr;
Writeln;
writeln('LAPORAN RENTAL MOBIL');
Writeln('===============================================================================');
Writeln('|No |Tanggal | Nama Pelanggan | Alamat | No Hp| Nama Mobil| Harga Per Hari| Lama Rental | Total Bayar |');
Writeln('===============================================================================');
For x := 1 to n do
begin
Writeln('|',x,'|',Data[x].tgl,'|',Data[x].nama,'|',Data[x].almt,'|',Data[x].hp,'|',data[x].kd_mbil,'|',Data[x].nm_mbil,
'|',Data[x].hrg:0:0,'|',Data[x].lm_rtl,'|',Data[x].tot:0:0,'|');
tot_slrh:=tot_slrh+Data[x].tot;
end;
Writeln('===============================================================================');
Writeln('Jumlah Pelanggan : ', a);
Writeln('total keseluruhan : Rp.',tot_slrh:0:0);
End.
Uses Wincrt;
Type rntl_mobil = record
no, tgl, nama, nm_mbil,almt,hp : String;
kd_mbil, lm_rtl : byte;
hrg, tot : real;
End;
Var
Data : Array [1..10] of rntl_mobil;
lagi : Char;
a,n, x : Integer;
tot_slrh : real;
Begin
Repeat
Clrscr;
a:=a+1;
Writeln(' ANUGRAH SENTOSA ');
Writeln(' Jl.Maju Terus no.7 Ciawi Tasikmalaya ');
Writeln('========================================');
Writeln;
writeln(' "RENTAL MOBIL" ');
Writeln;
Write('No : ');Readln(Data[a].no);
Write('Tanggal : ');Readln(Data[a].tgl);
Write('Nama Pelanggan : ');Readln(Data[a].nama);
Write('Alamat : ');Readln(Data[a].almt);
Write('No Hp : ');Readln(Data[a].hp);
writeln('STOK MOBIL:');
writeln('"001" (FERARRI)');
writeln('"002" (JAZZ)');
writeln('"003" (AVANZA)');
Write('Masukan Kode Mobil : ');Readln(Data[a].kd_mbil);
if Data[a].kd_mbil = 001 then
begin
Data[a].nm_mbil:='FERARRI';
Data[a].hrg:=3000000;
end;
if Data[a].kd_mbil = 002 then
begin
Data[a].nm_mbil:='JAZZ';
Data[a].hrg:=1000000;
end;
if Data[a].kd_mbil = 003 then
begin
Data[a].nm_mbil:='AVANZA';
Data[a].hrg:=500000;
end;
Writeln('Nama Mobil : ',Data[a].nm_mbil);
Writeln('Harga Per Hari : ',Data[a].hrg:0:0);
Write('Lama Rental : ');Readln(Data[a].lm_rtl);
Data[a].tot:=Data[a].lm_rtl*Data[a].hrg;
writeln('Total Bayar : ',Data[a].tot:0:0);
Writeln;
write('Tambah Data (y/t) : ');readln(lagi);
until lagi <> 'y';
n:=a;
Clrscr;
Writeln;
writeln('LAPORAN RENTAL MOBIL');
Writeln('===============================================================================');
Writeln('|No |Tanggal | Nama Pelanggan | Alamat | No Hp| Nama Mobil| Harga Per Hari| Lama Rental | Total Bayar |');
Writeln('===============================================================================');
For x := 1 to n do
begin
Writeln('|',x,'|',Data[x].tgl,'|',Data[x].nama,'|',Data[x].almt,'|',Data[x].hp,'|',data[x].kd_mbil,'|',Data[x].nm_mbil,
'|',Data[x].hrg:0:0,'|',Data[x].lm_rtl,'|',Data[x].tot:0:0,'|');
tot_slrh:=tot_slrh+Data[x].tot;
end;
Writeln('===============================================================================');
Writeln('Jumlah Pelanggan : ', a);
Writeln('total keseluruhan : Rp.',tot_slrh:0:0);
End.