Please send questions to st10@humboldt.edu .

Macintosh-194:131lect08-2 smtuttle$ expr_play
----------------------------------------------
Welcome to the 03-03-10 version of expr_play!
----------------------------------------------

Are there any already-created C++ functions (in the current 
   working directory) which you would like to be able to use
   within C++ expressions?
   (type y if so, n if not)
your answer: n

Enter a C++ expression, and type enter
   (or type q to quit):
sqrt(4)

value of sqrt(4): 
2

Enter next C++ expression and type enter
   (or type q to quit):
max(3, 5)

value of max(3, 5): 
5

Enter next C++ expression and type enter
   (or type q to quit):
q

Quitting expr_play ... goodbye.

Macintosh-194:131lect08-2 smtuttle$ funct_play2
----------------------------------------------
Welcome to the 03-03-10 version of funct_play2!
----------------------------------------------

Are there any already-created C++ functions (in the current 
   working directory) which you would like to be able to use
   within your new function?
   (type y if so, n if not)
your answer: n

Is your new function already in a file in the local directory?
(answer y or n): n

--- Entering a new function  ---

Enter the name for your new function:
Function name: circ_area

***** DESIGN RECIPE STEP 2.1: *****
Enter the contract for the function circ_area, using format:
   circ_area : parameter_type parameter_type ... -> return_type

Contract: circ_area : double -> double

Your contract for circ_area is:
--------------------------------------------------------
Contract: circ_area : double -> double
--------------------------------------------------------

***** DESIGN RECIPE STEP 2.2: *****
Enter a purpose statement for the function circ_area, 
   "a brief comment of what the function is to compute" [HtDP,
   p. 18]
(enter a line containing NOTHING but q and typing the Enter key
   to show when your purpose statement is complete):

Purpose: expects the radius of a circle and produces
         the area of that circle
q

Purpose statement:
---------------------------------------------------------------
Purpose: expects the radius of a circle and produces
         the area of that circle
---------------------------------------------------------------

***** DESIGN RECIPE STEP 2.3: *****
Enter the header for the function, using the format:
   return_type circ_area (param_type param_name, ...)

Function header:
double circ_area(double radius)

Your header for circ_area is:
-------------------------------------------------
double circ_area(double radius)
-------------------------------------------------

***** DESIGN RECIPE STEP 3: *****
Enter at least one example call of function circ_area
   including input(s) and the expected output given those
   input(s); for example,
      my_funct(3, 4) == 12
      my_funct(0, 0) == -3
(enter a line containing NOTHING but q and typing the Enter key
   to show when you have entered all of your examples):

Examples: circ_area(0) == 0
          abs(circ_area(10) - 314.159) < 0.001
q

Examples:
---------------------------------------------------------------
Examples: circ_area(0) == 0
          abs(circ_area(10) - 314.159) < 0.001
---------------------------------------------------------------

BEFORE you type in circ_area's body --- are there any
   NEW named constants that you want to CREATE?
   (answer y or n):

your reply: y

type in your new named constant declaration, using the format:
   const const_type CONST_NAME = expression;

new declaration: 
const double PI = 3.14159265;

do you have another named constant declaration?
   (enter y or n):

your reply: n

NOTE --- if a named constant was already declared for an
   OLD function that circ_area calls, then it SHOULD be 
   visible for use in circ_area, too...
(at least, it should be the way that funct_play2 sets these up ---
    we will discuss SCOPE later, and then perhaps discuss some
    other const declaration placement options.

***** DESIGN RECIPE STEPS 4, 5 *****
Enter the template/body of the circ_area (the part following the header),
   being sure to include the { and } that should enclose it.
(enter a line containing NOTHING but q and typing the Enter key
   to show when circ_area's body is complete):

Enter body following the header:

double circ_area(double radius)
{
    return PI * radius * radius;
}
q

circ_area's body:
----------------------------------------------------------------
{
    return PI * radius * radius;
}
----------------------------------------------------------------

COMPILING circ_area.cpp...
-----------------------------------------------------------------
circ_area.cpp COMPILED! 8-)

Would you like to run circ_area_ck_expect?
   (type y if so, n if not)
your answer: y


testing circ_area: true's should mean passed: 
---------------------------------------
(circ_area(0) == 0): true
(abs(circ_area(10) - 314.159) < 0.001): true


Enter a C++ expression involving:
circ_area
...and type enter
   (or type q to quit):
circ_area(10)

value of circ_area(10): 
314.159

Enter next C++ expression and type enter
   (or type q to quit):
circ_area(234.5)

value of circ_area(234.5): 
172757

Enter next C++ expression and type enter
   (or type q to quit):
q

Quitting funct_play2 ... goodbye.

Macintosh-194:131lect08-2 smtuttle$