created 08/13/99
Many of your programs from previous chapters can be used with file input and output without modification. Pick a few of them and play. Perhaps make a few modifications, such as removing prompts.
Click here to go back to the main menu.
Modify the program that adds five integers so that it first asks if further prompts are desired. The user enters "yes" or "no" (just once, at the beginning). Now the loop either prompts or does not prompt for each of the integers to be input.
You will need to use the equals()
method of String
.
Set a boolean variable to true or false
depending on the user's first input string.
There will be an if
statement inside the loop that determines
if a prompt is written.
Click here to go back to the main menu.