Question: Goal: Use a do - while loop to perform an input validation Assignment: Imagine you are creating a basic interface for a library management system.
Goal: Use a dowhile loop to perform an input validation
Assignment: Imagine you are creating a basic interface for a library management system. The system should continuously prompt the user to choose an action until they decide to exit. The actions could be adding a book, searching for a book, or exiting the system. For simplicity, the user will input A to add a book, S to search, and E to exit.
Given a string variable choice that has been declared, write a code snippet that repeatedly reads a value from the console into choice. The program should continue prompting the user until E or efor "Exit" is entered. If A or a is entered, print "Add Book
If S or s is entered, print "Search Book
For any other input, the program should ask for input again.
Enter your choice ASE: a
Add Book
Enter your choice ASE: S
Search Book
Enter your choice ASE: x
Enter your choice ASE: E
Note: Write the lines of code necessary to capture and validate only the user input. You do not need to write a complete program. You must use the do while loop in this exercise.
Question Ask an expert
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
