Start DrScheme, load square-root-computer into its
definition window, press the Execute button, and invoke square-root-computer (with no arguments, since its parameter list is
empty). By interacting with the program, find the square root of 7569.
Develop a Scheme procedure that collects two numbers from the user and prints out their sum.
Add the definition of multi-square-root-computer to the
DrScheme definition window and press Execute again. Invoke the
procedure and interact with it to find the square roots of 729, 15129, and
173056; then stop.
Define a Scheme procedure sum-of-inputs that takes no arguments and
returns the sum of as many numbers as the user chooses to type in. Prompt
the user for each addend, and have the user signal the end of the addends
by typing in the symbol end. An interaction with this procedure
might look like this:
Note that the sum is returned as the value of the procedure call, not printed as program output. (If it were printed as program output, it would appear inside the interaction box.)
Develop a Scheme procedure named yes-or-no-prompt that prompts the
user to type in a yes-or-no answer and reads in the response. Your
procedure should return #t if the user input is the symbol y
or the symbol yes and #f if the user input is the symbol
n or the symbol no. If the user input is anything other than
one of these four symbols, yes-or-no-prompt should invoke itself
recursively to repeat the prompt.
I am indebted to Professor Ben Gum for his contributions to the development of this lab.