Hands On C++: Project 3


The Projects

Your instructor will assign you one of the problems below. To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Following the pattern in the lab exercise, first, design using OCD; then code your design in C++ using stepwise translation; finally, test your program thoroughly.

For any of these projects, declare PI as a constant:

const double PI = 3.14159;

Project #3.1: Write a program to find the circumference and area of any circle. The formulas for these quantities are as follows:
circumference = 2 * PI * uservar.
area = PI * radius2.

Project #3.2: Write a program to find the side surface area and volume of any regular cylinder. The formulas for these quantities are as follows:
sideSurfaceArea = 2 * PI * radius * height.
volume = PI * radius2 * height.

Project #3.3: Write a program to find the circumference and area of any regular ellipse. The formulas for these quantities are as follows:
circumference = 2 * PI * the square root of (((height/2)2 + (width/2)2)/2).
area = PI * height/2 * width/2.

Project #3.4: Write a program to find the surface area and volume of any sphere. The formulas for these quantities are as follows:
surface area = 4 * PI * radius2.
volume = 4/3 * PI * radius3.

Turn In

Turn the following things:

  1. This grade sheet.
  2. Your OCD design.
  3. Your source program.
  4. The output from three different executions of your program.


Lab Home Page | Lab Exercise
© 2003 by Prentice Hall. All rights reserved.
Report all errors to Jeremy D. Frens.