Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

tapfu

  • one year ago

Write a program to simulate a vending machine and calculate change based on the amount paid. Given the cost, the user should first be prompted to add more money until the cost is met/exceeded by the payment. Assume that all change is given in coins only and coins come in the following denominations: R5, R2, R1, 50c, 20c, 10c, 5c

  • This Question is Open
  1. larrymud
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    This is a classic State Machine problem. Use the total deposited as the state. Use transition events like vend, addcoin and cancel. Many State Machine examples can be found online a good example for this problem is here: http://www.gamedev.net/blog/802/entry-2217738-system-design----finite-state-machines/

  2. Not the answer you are looking for?
    Search for more explanations.

    Search OpenStudy
    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.