Info
Warning
Danger
/
/
/
Question Description: For this week's lab you will program asimple finite

Question : Question Description: For this week's lab you will program asimple finite

Question

Description: For this week's lab you will program asimple finite state machine using structures. The FSM will model a rudimentary vending machine a which wil add nickels and dimes up to $0.20. Lask Specifics: The Moore type finite state machine described in Table-1isto be implemented in a C programusing structures and pointers. We will assume that it will be impossible for A and B to both be 1 at the same time. Present State Present output inputs Next State 0 1 2 20 Table-1: Finite State Machine Table. The following structure is to be used to store data for each state. struct FSM state unsigned int id; //state number unsigned int z; //output variable Z struct FSM state "next: //pointer to next state The program should start in state 0. The program should ask the user forthe input values A and B (A represents a nickel, B represents a dime). The program should then go to the next state based on the inputs, display the current state number as well as the current output value of Z (which represents the current total, then wait for the next input values. Use a pointer to keep track of the currentstate. Allow the user to enter a"2" for input A to exit out of the program.

 

Solution
5 (1 Ratings )

Solved
Computer Science 9 Months Ago 27 Views
This Question has Been Answered!
Expert Answer

Unlimited Access

Explore More than 2 Million+
  • Textbook Solutions
  • Flashcards
  • Homework Answers
  • Documents
Signup for Better Grades!

Ask an Expert

Our Experts can answer your tough homework and study questions
154049 Computer Science Questions Answered!
Post a Question