Skip to main content
Logo image

Section 23.1 LA2: Menu Selection

In your second Longer Assignment you’ll be asked to implement a menu of choices for the user. In order to help you out we’ll give you some sample code that you are welcome to use or modify.
The code below contains various stages of code development. Try to understand each one first by reading through the code and then give it a try by uncommenting the selection you’d like to understand. Note: Only the last version of the presented alternatives functions adequately. Can you figure out why?
The code below needs to be run on the server, not in a code window, in order to function properly.
Using characters as user input can be a bit tricky - make sure you understand what the issues are.
Suppose you wanted to have a menu of choices for the user as seen below and then at some point later in the program present the user with some other choices. Take a look at what happens if we implement this in the most straight-forward way:

admin.....open in new window