1 / 7

# NFA: Vending Machine Simulation - PowerPoint PPT Presentation

NFA: Vending Machine Simulation. Steven Stockall. Intro. NFA-Nondeterministic Finite Automaton - several possible states from current state, type of finite state machine Goals: Create a function NFA that works in a simulation

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' NFA: Vending Machine Simulation' - noel

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### NFA:Vending Machine Simulation

Steven Stockall

• NFA-Nondeterministic Finite Automaton - several possible states from current state, type of finite state machine

• Goals:

• Create a function NFA that works in a simulation

• Gain a greater understanding to the use of and applications for finite state machines

• Applications:

• Vending Machine

• Elevator

• Circuit hardware

• Machine accepts dimes, nickels, and quarters

• Monetary cap of \$1

• Monetary states for all valid change inputs

• Several purchase options:

• Purchase items will vary in price

• Invalid selections will return to current monetary state with prompt stating invalid selection

• Valid selections will drop item and return correct change

• ‘coin return’ button:

• Returns change

• Overflow:

• Monertary input over \$1 will be handled with an overflow state, this returns the amount of change equal to the amount over \$1 entered into the machine by the user

• Code:

• Design will be implemented in C#

• Design will have a small user interactive window with which the user can interact with and test the program

Code Organization

• Main that starts the core program

• Core:

• Program starts with a \$.00 state

• based on user input will call one of the modules passing in the user input and the old state

• modules will return new state

• Module that handles monetary selection:

• overflow will be handled within module

• Module that handles item selection:

• invalid selections return same state

• valid selections return item adjust change amount and returns remaining change then returns to \$.00 state

• Module that handles coin return:

• Returns coins

• Returns to \$.00 state

• Correct State transition:

• test to check state to state transition

• Correct State chaining:

• test to check state transitions are correct for long transition chains

• Correct input handling:

• Buttons work properly

• Correct cash overflow handling:

• purposely test all possible overflow states

• Goals:

• will be to see how a NFA works in real world applications

• create a functioning NFA

• create a workable vending machine simulation