Question: Stage 4 Implement the interactive mode, i . e . to prompt for and read menu commands. Set up a loop to obtain and process
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
database collection, search, restore, recruit, abandon, injured, battle, quit: roger
Not a valid command please try again.
of
Please enter choice
database collection, search, restore, recruit, abandon, injured, battle, quit: database
In database command
Please enter choice
database collection, search, restore, recruit, abandon, injured, battle, quit: search
In search command
Etc..
Please enter choice
database collection, search, restore, recruit, abandon, injured, battle, quit: quit
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
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
