In this program I give limited about selling books, clothes and trausers.
If buyer buy more 300000 rupiah, he will get discount 10 %.
For access this program :
Press 1 For buy books
Press 2 For buy clothes
Press 3 For buy trousers
Press 4 for exit this program
This is flow chart for KADAI Application :
this is source code :
[sourcecode language="C"]
#include<stdio.h>
#include<stdlib.h>
int main(void){
float bk1, bk2, bk3, bk4, bk5, total1, total2, total3;
float cl1,cl2,cl3,cl4,cl5,cl6,cl7,jumlah,diskon;
float bj1, bj2,bj3,bj4,bj5;
int pilih,pilih2;
start :
printf("===============================================================\n");
printf("|| Welcome to KADAI Application ||\n");
printf("|| Application for Shopping ||\n");
printf("|| created by : ||\n");
printf("|| 49013097 Rizki Syaputra D4 TMD - ITB ||\n");
printf("===============================================================\n");
printf("\n\n");
printf(" Get discount 10 persen every buy 300000+ \n");
printf("===============================================================\n");
printf("1. Books \n");
printf("2. Clothes \n");
printf("3. Trousers\n");
printf("4. Exit\n");
printf("Please choose for your buying : ");
scanf_s("%d",&pilih);
switch (pilih)
{
case 1:
printf("\n\nList Of Book Category !\n\n");
printf("1. Alqur'an big version Rp. 65000\n");
printf("2. Alqur'an small version Rp. 35000\n");
printf("3. Alfata Magazine Love After Merried Rp. 20000\n");
printf("4. Prepare married Rp. 97500\n");
printf("5. Believe in Allah Rp. 67500\n");
printf("\n\n");
printf("\nHow many Alqur'an big version do you want buy ? ");
scanf_s("%f",&bk1);
printf("\nHow many Alqur'an small version do you want to buy? ");
scanf_s("%f",&bk2);
printf("\nHow many Alfata Magazine Love After Married do you want buy ? ");
scanf_s("%f",&bk3);
printf("\nHow many Book Prepare Married do you want buy ? ");
scanf_s("%f",&bk4);
printf("\nHow many Book Believe in Allah do you want buy ? ");
scanf_s("%f",&bk5);
total1 = ((bk1 * 65000)+(bk2*35000)+(bk3*20000)+(bk4*97500)+(bk5*67500));
printf("\nPrice total books = %.3f\n",total1);
if(total1>=300000){
diskon = 0.1 * total1;
jumlah= total1-diskon;
printf("\nYou get discount 10 persen. Your discount is %.3f\n",diskon);
printf("\nYou only pay : %.3f\n", jumlah);
printf("\nThank you... \n\n\n");
printf("===============================================================\n");
printf("\n Do you to buy other or exit ? \n");
printf("Press 5 to back menu and buy other, Press 6 for exit : \n");
scanf_s("%d",&pilih2);
switch(pilih2)
case 5 :
goto start;
break;
case 6:
exit;
break;
return(0);
}else {
jumlah = total1;
printf("I'm sorry you not get discount. So, You must pay : %.3f\n",jumlah);
printf("\nThank you... \n\n\n");
printf("===============================================================\n");
printf("\n Do you to buy other or exit ? \n");
printf("Press 5 to back menu and buy other, Press 7 for exit : \n");
scanf_s("%d",&pilih2);
switch(pilih2)
case 5 :
goto start;
break;
case 7:
exit;
break;
return(0);
}
system("pause");
return(0);
break;
case 2 :
printf("\n\nList of Clothes Category \n\n");
printf("1.Boy Clothes Type 1 Rp 85000\n");
printf("2.Boy Clothes Type 2 Rp 95000\n");
printf("3.Short T-Shirt Rp 50000\n");
printf("4.Long T-Shirt Rp 75000\n");
printf("5.Women Clothes Type 1 Rp 65000\n");
printf("6.Women Clothes Type 2 Rp 75000\n");
printf("7.Women Clothes Type 3 Rp 85000\n");
printf("\n\n");
printf("\nHow many Boy Clothes Type 1 do you want to buy ? ");
scanf_s("%f",&cl1);
printf("\nHow many Boy Clothes Type 2 do you want to buy ? ");
scanf_s("%f",&cl2);
printf("\nHow many Short T-Shirt do you want to buy? ");
scanf_s("%f",&cl3);
printf("\nHow many Long T-Shirt do you want to buy ? ");
scanf_s("%f",&cl4);
printf("\nHow many Women Clothes Type 1 do you want to buy ? ");
scanf_s("%f",&cl5);
printf("\nHow many Women clothes Type 2 do you want to buy ? ");
scanf_s("%f",&cl6);
printf("\nHow many Women clothes type 3 do you want to buy ? = ");
scanf_s("%f",&cl7);
total2= ((cl1*85000)+(cl2*95000)+(cl3*50000)+(cl4*75000)+(cl5*65000)+(cl6*75000)+(cl7*85000));
printf("\nPrice total clothes = %f\n",total2);
if(total2>=300000){
diskon = 0.1 * total2;
jumlah= total2-diskon;
printf("\nYou get discount 10 persen. Your discount is %.3f\n",diskon);
printf("\nYou only pay : %.3f\n", jumlah);
printf("\nThank you... \n\n\n");
printf("===============================================================\n");
printf("\n Do you to buy other or exit ? \n");
printf("Press 5 to back menu and buy other, Press 8 for exit : \n");
scanf_s("%d",&pilih2);
switch(pilih2)
case 5 :
goto start;
break;
case 8:
exit;
break;
return(0);
}else {
jumlah = total2;
printf("I'm sorry you not get discount. So, You must pay : %.3f\n",jumlah);
printf("\nThank you... \n\n\n");
printf("===============================================================\n");
printf("\n Do you to buy other or exit ? \n");
printf("Press 5 to back menu and buy other, Press 11 for exit : \n");
scanf_s("%d",&pilih2);
switch(pilih2)
case 5 :
goto start;
break;
case 11:
exit;
break;
return(0);
}
system("pause");
return(0);
break;
case 3 :
printf("\n\nList of Trousers \n\n");
printf("1.Long Trousers Type 1 Rp 65000\n");
printf("2.Long Trousers Type 2 Rp 75000\n");
printf("3.Jeans Rp 110000\n");
printf("4.Short Trousers Type 1 Rp 85000\n");
printf("5.Short Trousers Type 2 Rp 95000\n\n\n");
printf("\nHow many Long trousers type 1 do you want to buy ? ");
scanf_s("%f",&bj1);
printf("\nHow many Long trousers type 2 do you want to buy ? ");
scanf_s("%f",&bj2);
printf("\nHow many Jeans do you want to buy? ");
scanf_s("%f",&bj3);
printf("\nHow many Short trousers type 1 do you want to buy ? ");
scanf_s("%f",&bj4);
printf("\nHow many Short trousers type 2 do you want to buy ? ");
scanf_s("%f",&bj5);
total3= ((bj1*65000) + (bj2*75000) + (bj3*110000)+ (bj4*85000)+ (bj5*95000));
printf("\nPrice total trousers = %f\n", total3);
if(total3>=300000){
diskon = 0.1 * total3;
jumlah= total3-diskon;
printf("\nYou get discount 10 persen. Your discount is %.3f\n",diskon);
printf("\nYou only pay : %.3f\n", jumlah);
printf("\nThank you... \n\n\n");
printf("===============================================================\n");
printf("\n Do you to buy other or exit ? \n");
printf("Press 5 to back menu and buy other, Press 9 for exit : \n");
scanf_s("%d",&pilih2);
switch(pilih2)
case 5 :
goto start;
break;
case 9:
exit;
break;
return(0);
}else {
jumlah = total3;
printf("I'm sorry you not get discount. So, You must pay : %.3f\n",jumlah);
printf("\nThank you... \n\n\n");
printf("===============================================================\n");
printf("\n Do you to buy other or exit ? \n");
printf("Press 5 to back menu and buy other, Press 0 for exit : \n");
scanf_s("%d",&pilih2);
switch(pilih2)
case 5 :
goto start;
break;
case 0 :
exit;
break;
return(0);
}
system("pause");
return(0);
break;
case 4 :
exit;
break;
default:
goto start;
printf("Please choose number 1 - 3 ! \n");
break;
}
}
[/sourcecode]
output program :
Main Menu
List Of Menu Books
This is My Video :
http://www.youtube.com/watch?v=Rs6LbX_W0Y4&feature=youtu.be
0 komentar:
Posting Komentar