CMPS 134                                                     Name: ___________________________

Lab # 1: The Mystery Function
due: September 8, 1998

Purpose:

In this lab you will run a program, providing it with data and recording the results.  You will then describe the relationship between input and output for the function.  Knowledge of the editor is not needed.  It is planned that some of the inputs that you will be asked to provide will produce error messages.

Activities:

To run the program, type at the system prompt:
$ RUN SYS$USERDISK:[MARTIN.PASCAL]MYSTERY1
To rerun the program, use the cursor up to bring this string back to your screen and then press the return key.

1. Run the program, provide the numbers below and record the results:

  input  output  input  output

    0   ______    1   ______

   -1   ______   12   ______

2. Some of the following will work and some will not.  What happens when you type each of the following inputs (write ERR if the input doesn't work):

  input  output  input  output

   ONE   ______   one   ______

     1.0   ______   1.9   ______

    A1   ______    1A   ______

  +1.X   ______    -12ABC   ______

  12E5   ______   -12   ______

Give a careful description of what rule the computer seems to be obeying when it decides what is "acceptable input":
>>>
 
 
 

 
 3. Run the program, provide the numbers below and record the results:

     input  output  input  output

    3   ______    -3   ______

   13   ______   -13   ______

  315   ______  -315   ______

   99   ______   -99   ______
 

What seems to be the pattern that results when using a positive or a negative integer as input:
>>>
 
 
 

What would we have to do to be sure that this pattern always holds true?
>>>
 
 
 
 

4. Continue running the program and guess what the relationship between input and output is.  We have suggested some data values to try.  You may wish to run the program for more data values.

     input  output  input  output

   11   ______   111   ______

  112   ______  1112   ______

   22   ______   122   ______

  ______  ______  ______  ______

  ______  ______  ______  ______

  ______  ______  ______  ______
 

Report:

Give a careful English description of the possible relationship of input and output:
>>>