Styles Lab 5 (100 Points) 1. as Source File) Lemonade Stand Simulator (60 Write
ID: 3754250 • Letter: S
Question
Styles Lab 5 (100 Points) 1. as Source File) Lemonade Stand Simulator (60 Write a program to simulate the operations of a Lemonade Stand. Your program shall track the inventory of the lemons, sugar, and number of beverages sold as well as the amount of money in the account. While water is a vital component of making lemonade, it will be considered free since it is supplied by the parents. L On start up the program shall assume the inventory of the store is initialized to the following. TEM LEMONS SUGAR MONEY BEVERAGES SOLD 0 INITIAL AMOUNT COST $o.So $2.62 per 5 Pound Bag N/A +$2.50 $10.00 Il. Your program shall prompt the user to choose an action. The menu shall look like the one shown below hase lenons Purchase Sugar I Sel1 Beverages Display Isventery election? If the action purchase lemons is selected, the program shall prompt the user to enter the number of lemons they wish to purchase. Lemons must be purchased whole, i.e. half a lemon cannot be purchased a. Upon the user entering the number of lemons, update the number of lemons in the inventory, decrease the funds in the account based on the quantity and price ($0.50) of the lemons purchased. L b. If the action purchase sugar is selected, the program shall prompt the user to enter the number of bags of sugar they wish to purchase. Again, bags must be purchased whole. L Upon the user entering the number of bags of sugar, update the number of pounds of sugar in the inventory, decrease the funds in the account based onExplanation / Answer
matlab code:
lem_cant=0; lem_cost = 0.5;
sug_cant=0; sug_cost = 2.62; %bag of 5 pounds
money = 10; bev_sold=0;
while(true)
prompt = '1.- Purchase Lemons 2.- Purchase Sugar 3.- Sell Beverages 4.- Display Inventory 5.- Exit ';
x = input(prompt);
if x==1
prompt1='Enter the number of lemons wished to purchase :';
x1=input(prompt1);
if floor(x1)==x1
lem_cant=x1;
money=money-lem_cost*x1;
else
display('Number of lemons must be integer.');
end
elseif x==2
prompt2='Enter the number of bags of sugar wished to purchase :';
x2=input(prompt2);
if floor(x2)==x2
sug_cant=x1*5; %in pounds
money=money-sug_cost*x2;
else
display('Number of bags of sugar must be integer.');
end
elseif x==3
prompt3='Number of beverages sold';
x3=input(prompt3);
if floor(x3)==x3
lem_cant = lem_cant -3*x3;
sug_cant=sug_cant - 0.1*x3;
bev_sold=bev_sold + x3;
money=money + 2.5*x3;
else
display('Number of Beverages sold must be integer.');
end
elseif x==4
display(strcat('Current account :',num2str(money)));
display(strcat('Number of beverages sold :',num2str(bev_sold)))
display(strcat('Number of lemons in inventory :',num2str(lem_cant)))
display(strcat('Pounds of sugar in inventory :',num2str(sug_cant)))
elseif x==5
break;
else display('Wrong Selection')
end
end