Jump to content

Select Function with "vending Machine


Recommended Posts

I was given this problem to simulate a vending machine and to add the total cost and total money input and have it calculate out the change due or more money needed. I have set it up to calculate the total cost and input values but it then asks to use the select function (true false) to compute the change due or change needed and im not sure how to wire the select function into it.

post-54183-0-68726600-1448034183.png

Link to comment

They probably want you to compare total cost and the total input. Use a "greater or equal to" function which will generate a Boolean and wire this Boolean to the Select input:

 

If Input >= Cost then Change Due = Input - Cost and Additional Money Needed = 0

If Input < Cost then Change Due = 0 and Additional Money Needed = Cost - Input

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.