--------------------------------------------------------------------------------------------------------------------------
program Menghitung_Total_Bayar;
uses crt;
var
kode_brg,harga_satuan,jumlah_brg,harga_barang :integer;
nama_brg : string;
total_bayar,diskon : real;
begin
window(5,2,35,24);textbackground(blue);
clrscr;
//kode barang
gotoxy(5,2);textcolor(white);
writeln('Masukan kode barang');
gotoxy(5,3);textcolor(white);
writeln('===================');
gotoxy(5,4);textcolor(white);
write('Kode barang : ');readln(kode_brg);
//nama barang
gotoxy(5,6);textcolor(white);
writeln('Masukan nama barang');
gotoxy(5,7);textcolor(white);
writeln('===================');
gotoxy(5,8);textcolor(white);
write('Nama barang : ');readln(nama_brg);
//harga satuan
gotoxy(5,10);textcolor(white);
writeln('Masukan harga satuan');
gotoxy(5,11);textcolor(white);
writeln('====================');
gotoxy(5,12);textcolor(white);
write('Harga satuan : ');readln(harga_satuan);
//jumlah_brg
gotoxy(5,14);textcolor(white);
writeln('Masukan jumlah barang');
gotoxy(5,15);textcolor(white);
writeln('====================');
gotoxy(5,16);textcolor(white);
write('Jumlah barang : ');readln(jumlah_brg);
window(45,2,75,24);textbackground(blue);
clrscr;
//kode barang
gotoxy(3,2);textcolor(white);
write('KODE BARANG :');
gotoxy(20,2);textcolor(white);
write(kode_brg);
gotoxy(3,3);textcolor(white);
write('==============');
//nama barang
gotoxy(3,5);textcolor(white);
write('NAMA BARANG :');
gotoxy(20,5);textcolor(white);
write(nama_brg);
gotoxy(3,6);textcolor(white);
write('==============');
//harga satuan
gotoxy(3,8);textcolor(white);
write('HARGA SATUAN :');
gotoxy(20,8);textcolor(white);
write(harga_satuan);
gotoxy(3,9);textcolor(white);
write('==============');
//jumlah barang
gotoxy(3,11);textcolor(white);
write('JUMLAH BARANG :');
gotoxy(20,11);textcolor(white);
write(jumlah_brg);
gotoxy(3,12);textcolor(white);
write('==============');
harga_barang := jumlah_brg*harga_satuan;
if(jumlah_brg > 3)
then
diskon:= harga_barang*0.1;
total_bayar := harga_barang-diskon;
gotoxy(3,14);textcolor(white);
write('Harga semua barang :');
gotoxy(25,14);textcolor(white);
write(harga_barang);
gotoxy(3,17);textcolor(white);
write('Anda mendapat diskon');
gotoxy(3,18);textcolor(white);
write('sebesar 10%');
gotoxy(3,20);textcolor(white);
write('Total :');
gotoxy(25,20);textcolor(white);
write(total_bayar:0:1);
readln;
end.
--------------------------------------------------------------------------------------------------------------------------
Download Scriptnya :
catatan :
hargailah tulisan orang lain, jika anda mengcopy-paste harap cantumkan link sumber.
0 komentar