Question: Design, implement, and test a program in the file named commandinterpreter.py that uses a simple text - based command interpreter. The program s main function
Design, implement, and test a program in the file named commandinterpreter.py that uses a simple textbased command interpreter.
The programs main function
Displays a menu of commands.
Accepts an input command from the user.
Calls a function to perform the command.
Repeats steps a through c until the user selects the "Quit" command.
The program should define three other functions, named printMenu, acceptCommand, and performCommand, to carry out steps a b and c respectively. The function to display the menu expects a list of menu options as an argument and displays these options prefixed with numbers. The function to accept an input command expects the length of the menu list as an argument. The function repeatedly prompts the user for a number in the range of options and takes inputs until the user enters a number within the range. The function either displays an error message for an invalid input or returns a valid input. The function to perform a command takes a command number and the menu as arguments and displays the selected command in the menu. Test your program with the menu Open "Save", "Compile", "Run", "Quit" and at least one other menu. Note that all menus must include a "Quit" command as the last item in the menu. LO:
Run tests for task
Task : Design and implement a program that uses a simple textbased command interpreter.
An example of the program is shown below:
Open
Save
Compile
Run
Quit
Enter a number:
Command Save
Open
Save
Compile
Run
Quit
Enter a number:
Command Compile
Open
Save
Compile
Run
Quit
Enter a number:
Command Quit
Have a nice day!
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
