Tuesday, December 19, 2023

CUSTOMER FRIENDLY FRUIT VENDOR MACHINE IN c

 FRUIT PURCHASE VENDOR MACHINE PROCESS  WITH  CUSTOMER FRIENDLY   🤝


Scenario: A customer goes to Aakash super market  the customer goes to buy fruits like apples🍎 ,orange🍊 ...

the customer wants to go to one of the vendor machine there and buy fruits as per her /his choice like in kilo gram or no of fruits and the total calculation ...                            




#include<stdio.h>
void main()
{
    int n_o_f,op=1,opn,bop;
float p_a_kg_p=200,c_o_b_f,p_a_p=15,n_o_f_kg,p_o_kg_p=300,p_o_p=8,p_gc_p=25,p_gc_kg_p=150,total_cost=0;

// defaultly i set the apple,orange and grape prices in kg and its single piece price.
while(op==1){
printf("Akash super market");
    printf("1.apple\n2.Orange\n3.grape\n");
printf("\t                     Enter the fruit choice :");
scanf("%d",&opn);  // customer would like to select anything of in this  options.
if(opn==1)
{

system("color 1A");// console area bg color and text color formatting. 
printf("APPLE\n");🍎
printf("Want to buy in kg press =1\n Want to buy in count=2\n");// choice depends upon the customer's mindset.customers have two option to buy one is in kilo gram㎏ and another one is in count🔢.
this process is help to easy the purchase process to the customers. 

printf("Enter the buy option :");
scanf("%d",&bop);
if (bop==1){
 
printf("Enter the no of kg :");
scanf("%f",&n_o_f_kg);
c_o_b_f=p_a_kg_p*n_o_f_kg;
total_cost= total_cost + c_o_b_f;// in this place the total will added one by one value before the current purchase.

printf("\t           cost for buying fruit :%.2f",c_o_b_f);
}
else if(bop==2){
printf("Enter the no of apples :");
scanf("%d",&n_o_f);
c_o_b_f=p_a_p*n_o_f;
total_cost=total_cost+c_o_b_f;
printf("\t            cost for buying fruit :%.2f\n",c_o_b_f);
}
}
else if (opn==2){
printf("orange\n");🍊
printf("Want to buy in kg press =1\n Want to buy in count=2\n");
    printf("Enter the buy option :");
    scanf("%d",&bop);
    if (bop==1){
 
printf("Enter the no of kg :");
scanf("%f",&n_o_f_kg);
c_o_b_f=p_o_kg_p*n_o_f_kg;
total_cost=total_cost+c_o_b_f;
printf("\t                    cost for buying fruit :%.2f\n",c_o_b_f);
}
else if(bop==2){
printf("Enter the no of ORANGE :");
scanf("%d",&n_o_f);
c_o_b_f=p_o_p*n_o_f;
total_cost=total_cost+c_o_b_f;
printf("\t                     cost for buying fruit :%.2f\n",c_o_b_f);
}
}
  else if (opn==3){
printf("grape\n");🍇
printf("Want to buy in kg press =1\n Want to buy in count=2\n");
    printf("Enter the buy option :");
    scanf("%d",&bop);
    if (bop==1){
 
printf("Enter the no of kg :");
scanf("%f",&n_o_f_kg);
c_o_b_f=p_gc_kg_p*n_o_f_kg;
total_cost=total_cost+c_o_b_f;
printf("\t                      cost for buying fruit :%.2f\n",c_o_b_f);
}
else if(bop==2){
printf("Enter the no of grapes cose :");
scanf("%d",&n_o_f);
c_o_b_f=p_gc_p*n_o_f;
total_cost=total_cost+c_o_b_f;
printf("\t                       cost for buying fruit :%.2f\n",c_o_b_f);
}
}

printf(".\n.\n IF YOU WANT TO CONTINUE \n 1=yes \t 0=no\n.\n.\n");
scanf("%d",&op);
// As seen earlier this condition take the program into loop .which means the process run again without have any execution .But the condition not satisfy the  entry level loop (While)the whole program will exit

}
printf("TOTAL AMOUNT : %.2f",total_cost);
}

//In this program we have learned.How customer can register in ihs/her own choice .This concept it will be not only at this place and also at various scenarios.We will know that in the upcoming posts

___________________________________________________________________________________
OUTPUT
1.apple
2.Orange
3.grape
                             Enter the fruit choice :1
APPLE
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :1
Enter the no of kg :1
                   cost for buying fruit :200.00.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.

1
____________________________________________________

1.apple
2.Orange
3.grape
                             Enter the fruit choice :1                                     🍎
APPLE
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :2
Enter the no of apples :2
                    cost for buying fruit :30.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
0               // in this place the loop add the previous purchase price and its carry that for nxt purchase.
TOTAL AMOUNT : 230.00
-----------------------------------------------------------------------------------------------------------------------------
1.apple
2.Orange
3.grape
                             Enter the fruit choice :2                                  🍊      
ORANGE
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :1
Enter the no of kg :1
                            cost for buying fruit :300.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
1
1.apple
2.Orange
3.grape
                             Enter the fruit choice :2
orange
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :2
Enter the no of ORANGE :2
                             cost for buying fruit :16.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
0
TOTAL AMOUNT : 316.00
-----------------------------------------------------------------------------------------------------------------------------
1.apple
2.Orange
3.grape
                             Enter the fruit choice :3                                    🍇       
GRAPE                                                       
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :1
Enter the no of kg :1
                              cost for buying fruit :150.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
1
1.apple
2.Orange
3.grape
                             Enter the fruit choice :3
grape
Want to buy in kg press =1
 Want to buy in count=2
Enter the buy option :2
Enter the no of grapes cose :2
                               cost for buying fruit :50.00
.
.
 IF YOU WANT TO CONTINUE
 1=yes   0=no
.
.
0
TOTAL AMOUNT : 200.00


C Program Heading

#include <stdio.h> int main()

1 comment:

DDL command in sql

DATA DEFINITION LANGUAGE DBMS language database language are used to read,update and store data in a database.There are several suc...