Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stage 4 Implement the interactive mode, i . e . to prompt for and read menu commands. Set up a loop to obtain and process

Stage 4
Implement the interactive mode, i.e. 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.
14 of 23
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 5
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 function(s).
For the remaining commands, the following implementation order is suggested (note: this is a guide only):
database command (display_creatures() function).
collection command (display_creatures() function).
search command (calls the find_creature() function).
restore command (calls the find_creature() function).
injured command (calls the display_injured() function).
recruit command (calls the recruit_creature() function).
abandon command (calls the abandon_creature() function).
battle command (do_battle() 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 6
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 7
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.
image text in transcribed

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

Students also viewed these Databases questions