NEED ASAP! NEED VERY QUICKLY! 14 25pts) your friends have a store that sells bev
ID: 3551728 • Letter: N
Question
NEED ASAP! NEED VERY QUICKLY!
14 25pts) your friends have a store that sells beverages. They asked you to write a c program to help them their purchases and store transactions. They want a main menu for the program that will allow the customer to choose from. The menu items are (with each line starting with the letter that user can press for that item): WELCOME To our Store MAIN MENU Coffee C: S: Soda o: Orange Juice F: Finalize bill Cancel this bill and reset for a new customer Q: Quit Enter the desired option. If the user presses C, you need to need ask him or her how many coffees he ordered. The price for coffee is SI.55Explanation / Answer
#include<stdio.h>
main()
{
int i,coffee=0,soda=0,small_orange=0,big_orange=0,flag=1;
float cost;
char c,s;
while(flag)
{
printf("============= Welcome to our Store Main Menu =============== ");
printf("C:Coffee S:Soda O:Orange Juice F:Finalize Bill *:Cancel this bill andreset for a new customer Q:Quit ============= Enter the desired option... ");
scanf("%s",&c);
if (c=='C')
{
printf("No. of coffee ");
scanf("%d",&i);
coffee= coffee+i;
}
if (c=='S')
{
printf("No. of soda ");
scanf("%d",&i);
soda= soda+i;
}
if (c=='O')
{
printf("Which one? S:Small B:big ");
scanf("%s",&s);
printf("No. of Orange ");
scanf("%d",&i);
if(s=='S'){small_orange = small_orange+i;}
if(s=='B'){big_orange = big_orange+i;}
}
if (c=='F')
{
printf("BILL OF SALE =============== ");
if(coffee){printf("%d coffee: $%f ",coffee,coffee*1.55);}
if(soda){printf("%d soda: $%f ",soda,soda*1.44);}
if(small_orange){printf("%d Small Orange: $%f ",small_orange,small_orange*1.2);}
if(big_orange){printf("%d Big Orange: $%f ",big_orange,big_orange*2.5);}
printf("================ Total: $%f ================ ",(coffee*1.55)+(soda*1.44)+(small_orange*1.2)+(big_orange*2.5));
flag=0;
}
if (c=='*')
{coffee=0,soda=0;small_orange=0;big_orange=0;}
if (c=='Q')
{flag=0;}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.