Lecture 4 Objectives


At the end of today's class you should

KNOW:

BE ABLE TO:

Sample Exam Question:

Given this function description:

The function named Volume uses a char called shape and two floats called dimension1 and dimension2 to determine the volume of a geometric shape. It is assumed that upon entry to the function, the value of shape is either 'C', 'Y', or 'T' (for cone, cylinder, or torus). It is also assumed that the values of dimension1 and dimension2 are greater than 0.0.

  1. Draw the function as a "black box" with inputs and outputs shown as labelled arrows. Indicate the data type associated with each arrow.
  2. Write a prototype for this function.
  3. Write a pre-condition for this function.
  4. Write the function as a stub.