Program Discount Hotel
SOAL :
sebagai input:
- masukan berapa lama menginap
- masukan harga kamar per hari
- jumlah bayar
- keterangan
jumlah bayar ==> harga kamar per hari * lama menginap
keterangan ==> discount atau no discount
jumlah >= 300.000 dapat discount 30%
200.000 >= jumlah <= 300.000 dapat discount 20%
100.000 >= jumlah <= 200.000 dapat discount 10%
jumlah <= 100.000 dapat no discount
sebagai output:
- jumlah bayar
- keterangan (discount or no discount)
- total biaya akhir
total biaya akhir ==> jumlah - ( jumlah * (besar diskon) )
buat lah program nya! disertai flowchart!
JAWAB:
Download flowchrat.pdf ==> kumpulbagi.id || drive.google
CODING PASCAL
program discount;
uses crt;
var
lm : byte;
hk, jml, byrakh : real;
ket : String[30];
begin
clrscr;
writeln('*********************************************************');
writeln('* SELAMAT DATANG *');
write('* LAMA MENGINAP = ');
readln (lm);
writeln('=========================================================');
write('* HARGA KAMAR = Rp.');
readln (hk);
writeln('=========================================================');
jml := hk * lm;
if jml <= 100000 then begin
ket := ('No Discount');
byrakh := jml;
end else if (100000 <= jml) and (jml <= 200000) then begin
ket := ('Discount 10%');
byrakh := jml- (jml*0.1);
end else if (200000 <= jml) and (jml <= 300000) then begin
ket := ('Discount 20%');
byrakh := jml- (jml*0.2);
end else if jml >= 300000 then begin
ket := ('Discount 30%');
byrakh := jml - (jml*0.3);
end;
writeln ('* jumlah bayar = Rp.', jml:8:2);
writeln ('* keterangan ', ket );
writeln('=========================================================');
writeln ('* total bayar = Rp.', byrakh:8:2);
writeln('* terima kasih *');
writeln('*********************************************************');
end.
SELAMAT MENCOBA, SEMOGA BERHASIL :)
password : tei-ti.blogspot.co.id
password : tei-ti.blogspot.co.id
BY. MAULANA MUCHLISH
DOSEN. WAHYU T, M.MPd
No comments:
Post a Comment