Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The requirements of the program in Care summarized below. 1. Create an executable program simState (based on C source code) that is able to respond

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
The requirements of the program in Care summarized below. 1. Create an executable program simState (based on C source code) that is able to respond to the commands described below. C source code: #include #include int main(int arge, char* argv[]X exit(0); } 2. Your program will be presented with zero or more commands from stdin (each on a line by itself) and must respond precisely as specified for each command as listed below. No Commands: Before any commands are issued to your program, it should print out the starting state. One/Zero Commands: These commands (a 'O' or a 'l' on a line by itself) must print to stdout the name of the next state given the supplied input, and update the current state. Change command: The change command is invoked by the letter c'followed by a l'or a 'O' followed by the name of a state (i.e. a single letter in the range A-H). This command modifies the state machine such that the '0' or 'l') command applied to the current state will cause the machine to change to the named state and that this change is the state machine configuration will continue. This command should produce no output. Print command: The print command is invoked with the single letter 'p'. It should print to stdout the state machine configuration as currently specified (i.e. including changes that may have been made with change commands) in the same format that your state machine was specified with Garbage Identify command: This command is invoked with the single letter 'g!. It should identify all states that are reachable or unreachable from the current state. It always produces output to stdout. If all states are reachable, it should output no garbage. Otherwise, it should output Garbage: where is the list of the state names that are no longer reachable. Delete command: This command is invoked with 'd', optionally followed by the name of a state to delete. When the di command is invoked without the optional argument, it should delete (i.e. mark as "deleted") all un-deleted states that are unreachable. If there are no such unreachable un-deleted states, it should print: No states deleted. Otherwise, it should print the message: Deleted: If the 'd' command is followed by an argument that it the valid name of a state, it should print out either the message: Deleted if the state is not reachable and not already deleted. Otherwise, it should print out the message: Not deleted. If a state is successfully deleted, it should no longer appear in the list of states produced by the print command and it should be disallowed as a final argument to the change command. Each line of the state machine has the following format: is the name of the state being defined, is the name of next state if the input is '0'; and

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft SQL Server 2012 Unleashed

Authors: Ray Rankins, Paul Bertucci

1st Edition

0133408507, 9780133408508

More Books

Students also viewed these Databases questions