Object:
Kode 1 TV : Rp 2.000.000
Kode 2 DVD : Rp 650.000
Kode 3 CD ROOM : Rp 450.000
Kode 4 KULKAS : Rp 1.800.000
Kode 5 COSMOS : Rp 300.000
Apabila Total diatas 1.000.000 maka discount nya 10%
Apabila Total diatas 2.000.000 maka discount nya 15%
Apabila Total diatas 4.000.000 maka discount nya 20%
Berukut Listing Programnya:
#include"stdio.h"
#include"conio.h"
void main()
{
int i,kode[15],jumlah[15],jumdata=5;
char*produk;
float harga,total,disc,pembayaran,jwb;
printf("\n =|============================|= ");
printf("\n =|| INPUT DATA PENJUALAN ||= ");
printf("\n =|| TOKO AZMY LAURANITA BLOG ||=");
printf("\n =|============================|=");
for(i=0;i<jumdata;i++){
printf("\n Masukkan Kode [1,2,3.4,5] :") ;scanf("%d",&kode[i]);
printf(" Jumlah Produk :") ;scanf("%d",&jumlah[i]);
printf("\n -------------------------");
}
clrscr();
printf("\n | INFORMASI PENJUALAN PRODUK |");
printf("\n____________________________________________________________________________");
printf("\nNo|KODE | PRODUK | HARGA | JUMLAH | TOTAL | DISCOUNT | PEMBAYARAN |");
printf("\n__|_____|__________|_________|________|____________|__________|____________|");
for(i=0;i <jumdata;i++){
if(kode[i]==1){
produk="TV"; harga=2000000;
}else if(kode[i]==2){
produk="DVD"; harga=650000;
}else if(kode[i]==3){
produk="CD ROOM"; harga=450000;
}else if(kode[i]==4){
produk="KULKAS"; harga=1800000;
}else if(kode[i]==5){
produk="COSMOS";harga=300000;
}
total=harga*jumlah[i];
if(total> 1000000)disc=0.1*total;
else
if(total> 2000000)disc=1.5*total;
else
if(total> 4000000)disc=0.2*total;
pembayaran=total-disc;
gotoxy(1,6+i);printf( "%i | %d | %s ",i+1,kode[i],produk);
gotoxy(20,6+i);printf("| %7.0f | %i | %7.0f | %7.0f | %7.0f |" ,harga,jumlah[i],total,disc,pembayaran);
}
printf("\n===========================================================================|");
printf("\n TOKO AZMY LAURANITA BLOG |");
printf("\n============================================================================");
}
Maka hasilnya seperti ini:
Screen Shot Penginputan nya
Screen Shot Hasilnya:
Tidak ada komentar:
Posting Komentar