# (Solved): In MATLAB please! Thank you! Create a function with the following key features: a. Draw at six but ...

Create a function with the following key features:

a. Draw at six buttons in a figure window (fill, make the buttons 5 wide and high, and don’t forget to use hold on, and check out axis(‘equal’)).

b. Place text (text) on five of those buttons to represent five different food items with five different prices (store the prices in a a vector too!); the last button needs to be a “vend/ done” button.

c. Tell the user to click on the items they would like (disp, ginput)

i. For each click, identify which button they have clicked on. Use the Euclidean distance, is the click within 2.5 units of the center of the button? r = sqrt( ([x2, y2] - [xn, yn])2 ), where [x2, y2] is the click point, and [xn, yn] is the center of the “fill” button (use if/elseif/else).

ii. Keep track of the items they have selected (selections = [selections, new_selection]).

iii. If they did not select “vend/done” then ask for another selection (while).

d. Once they selected the vend button, wow tell the user the total they owe, sum of the prices of selections, and start accepting coins.

e. Provide the change (return value), and for each item purchased, tell them “here is your ____” (foreach item in selections, switch on selections for the specific food).

We have an Answer from Expert