#include <stdio.h>
#include <conio.h>
void tiga_barang()
{
char x,y,z;
int j,k,l;
printf("Kode Barang :\n");
printf("\t A => Odol\n");
printf("\t B => Sabun\n");
printf("\t C => Sabun Cuci\n");
printf("Masukkan Kode dan Jumlah Baarang :\n");
int a,b,c;
printf(" Kode Barang 1 :");scanf("%s",&x);
if(x=='a'){ printf("\t\tOdol\n") ;printf("Jumlah Barang :"); scanf("%d",&j); a=3000*j; printf("Nama Barang : Odol x 3000 x %d\t = %d\n",j,a);}
if(x=='b'){ printf("\t\tSabun\n");printf("Jumlah Barang :"); scanf("%d",&j); a=4500*j; printf("Nama Barang : Sabun x 4500 x %d\t = %d\n",j,a);}
if(x=='c'){ printf("\t\tSabun Cuci\n");printf("Jumlah Barang :"); scanf("%d",&j); a=3000*j; printf("Nama Barang : sabun cuci x 3000 x %d = %d\n",j,a);}
printf(" \n Kode Barang 2 :");scanf("%s",&y);
if(y=='a'){ printf("\t\tOdol\n") ;printf("Jumlah Barang :"); scanf("%d",&k); b=3000*k; printf("Nama Barang : Odol x 3000 x %d\t = %d\n",k,b);}
if(y=='b'){ printf("\t\tSabun\n");printf("Jumlah Barang :"); scanf("%d",&k); b=4500*k; printf("Nama Barang : Sabun x 4500 x %d\t = %d\n",k,b);}
if(y=='c'){ printf("\t\tSabun Cuci\n");printf("Jumlah Barang :"); scanf("%d",&k); b=3000*k; printf("Nama Barang : sabun cuci x 3000 x %d = %d\n",k,b);}
printf(" \n Kode Barang 3 :");scanf("%s",&z);
if(z=='a'){ printf("\t\tOdol\n") ;printf("Jumlah Barang :"); scanf("%d",&l); c=3000*l; printf("Nama Barang : Odol x 3000 x %d\t = %d\n",l,c);}
if(z=='b'){ printf("\t\tSabun\n");printf("Jumlah Barang :"); scanf("%d",&l); c=4500*l; printf("Nama Barang : Sabun x 4500 x %d\t = %d\n",l,c);}
if(z=='c'){ printf("\t\tSabun Cuci\n");printf("Jumlah Barang :"); scanf("%d",&l); c=3000*l; printf("Nama Barang : sabun cuci x 3000 x %d = %d\n",l,c);}
int d=a+b+c;
printf("\nTotal\t = Rp%d + Rp%d + Rp%d = Rp%d\n",a,b,c,d);
int e;
printf("Masukkan Uang Belanja = Rp "); scanf("%d",&e);
int f=e-d;
printf("\nKembalian = Rp%d - Rp%d = Rp%d",d,e,f);
}
void dua_barang()
{
char x,y;
int j,k;
printf("Kode Barang :\n");
printf("\t A => Odol\n");
printf("\t B => Sabun\n");
printf("\t C => Sabun Cuci\n");
printf("Masukkan Kode dan Jumlah Baarang :\n");
int a,b;
printf(" Kode Barang 1 :");scanf("%s",&x);
if(x=='a'){ printf("\t\tOdol\n") ;printf("Jumlah Barang :"); scanf("%d",&j); a=3000*j; printf("Nama Barang : Odol x 3000 x %d\t = %d\n",j,a);}
if(x=='b'){ printf("\t\tSabun\n");printf("Jumlah Barang :"); scanf("%d",&j); a=4500*j; printf("Nama Barang : Sabun x 4500 x %d\t = %d\n",j,a);}
if(x=='c'){ printf("\t\tSabun Cuci\n");printf("Jumlah Barang :"); scanf("%d",&j); a=3000*j; printf("Nama Barang : sabun cuci x 3000 x %d = %d\n",j,a);}
printf(" \n Kode Barang 2 :");scanf("%s",&y);
if(y=='a'){ printf("\t\tOdol\n") ;printf("Jumlah Barang :"); scanf("%d",&k); b=3000*k; printf("Nama Barang : Odol x 3000 x %d\t = %d\n",k,b);}
if(y=='b'){ printf("\t\tSabun\n");printf("Jumlah Barang :"); scanf("%d",&k); b=4500*k; printf("Nama Barang : Sabun x 4500 x %d\t = %d\n",k,b);}
if(y=='c'){ printf("\t\tSabun Cuci\n");printf("Jumlah Barang :"); scanf("%d",&k); b=3000*k; printf("Nama Barang : sabun cuci x 3000 x %d = %d\n",k,b);}
int d=a+b;
printf("\nTotal\t = Rp%d + Rp%d = Rp%d\n",a,b,d);
int e;
printf("Masukkan Uang Belanja = Rp "); scanf("%d",&e);
int f=e-d;
printf("\nKembalian = Rp%d - Rp%d = Rp%d",d,e,f);
}
void satu_barang()
{
char x;
int j;
printf("Kode Barang :\n");
printf("\t A => Odol\n");
printf("\t B => Sabun\n");
printf("\t C => Sabun Cuci\n");
printf("Masukkan Kode dan Jumlah Baarang :\n");
int a;
printf(" Kode Barang 1 :");scanf("%s",&x);
if(x=='a'){ printf("\t\tOdol\n") ;printf("Jumlah Barang :"); scanf("%d",&j); a=3000*j; printf("Nama Barang : Odol x 3000 x %d\t = %d\n",j,a);}
if(x=='b'){ printf("\t\tSabun\n");printf("Jumlah Barang :"); scanf("%d",&j); a=4500*j; printf("Nama Barang : Sabun x 4500 x %d\t = %d\n",j,a);}
if(x=='c'){ printf("\t\tSabun Cuci\n");printf("Jumlah Barang :"); scanf("%d",&j); a=3000*j; printf("Nama Barang : sabun cuci x 3000 x %d = %d\n",j,a);}
int d=a;
printf("\nTotal\t = Rp%d\n",d);
int e;
printf("Masukkan Uang Belanja = Rp "); scanf("%d",&e);
int f=e-d;
printf("\nKembalian = Rp%d - Rp%d = Rp%d",d,e,f);
}
int main ()
{
printf("============Program Kasir Minimarket===================\n");
printf("Untuk Menghitung Barang Max. SATU Tekan ' 1 '\n");
printf("Untuk Menghitung Barang Max. DUA Tekan ' 2 '\n");
printf("Untuk Menghitung Barang Max. TIGA Tekan ' 3 '\n");
int m;
printf("Silahkan Tekan :"); scanf("%d",&m);
switch(m)
{
case 1:
printf("\n");
satu_barang(); break;
case 2:
printf("\n");
dua_barang(); break;
case 3:
printf("\n");
tiga_barang(); break;
default:
printf("\n");
printf("Input Salah"); break;
}
getch ();
return 0;
}
Tidak ada komentar:
Posting Komentar