Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write the following stages using C code language ( Take into consideration of how the code should be displayed given the sample output )
Please write the following stages using C code language Take into consideration of how the code should be displayed given the sample output
Stage
Implement the interactive mode, ie to prompt for and read menu commands. Set up a loop to obtain and process
commands. Test to ensure that this is working correctly before moving onto the next stage. You do not need to call
any functions at this point, you may simply display an appropriate message to the screen.
It is suggested that you use function gets to read user input from the keyboard.
For example:
Sample output:
Please enter choice
Not a valid command please try again.
Please enter choice
In database command
Please enter choice
In search command
Etc...
Please enter choice
Menu input should be validated with an appropriate message being displayed if incorrect input is entered by the user.
Stage
Implement one command at a time. Test to ensure the command is working correctly before starting the next command.
Start with the quit and list commands as they do not need you to add anything further to the file other than ensuring
that the function calls are in the correct place.
You should be able to see that for most commands there is a corresponding functions
For the remaining commands, the following implementation order is suggested note: this is a guide only:
database command displaycreatures function
collection command displaycreatures function
search command calls the findcreature function
restore command calls the findcreature function
injured command calls the displayinjured function
recruit command calls the recruitcreature function
abandon command calls the abandoncreature function
battle command dobattle function
Note: you do not need the battle function working to test all prior functions. You can
directly modify the txt files for testing purposes.
Stage
Ensure that you have validated all user input with an appropriate message being displayed for incorrect input entered
by the user. Add code to validate all user input. Hint: use a while loop to validate input.
Stage
Finally, check the sample output see section titled 'Sample Output' towards the end of this document and if necessary,
modify your code so that:
The output produced by your program EXACTLY adheres to the sample output provided.
Your program behaves EXACTLY as described in these specs and the sample output provided.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started