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.

Project #1.1: Modify the program from the lab exercise to also print out the area of the triangle:double area = 0.5 * leg1 * leg2; cout << "The area is " << area << endl;

Note: In the following formulas,π is the symbol for "pi" on this browser.

Project 1.2. Write a program to input the radius of a circle and then compute and output its circumference and area. The formulas for these quantities are as follows:

circumference= 2 πr

area= πr^{2}

where r is the radius of the circle.

Project 1.3. Write a program to input the radius of the circular base and the height of a right circular cylinder and then compute and output its surface area and volume. The formulas for these quantities are as follows:surface area= 2 πrh

volume= πr^{2}h

where r is the radius of the circular bases of the cylinder and h is its height.

Project 1.4. Write a program to input the lengths of the two axes of an ellipse and the compute and output its circumference and area. The formulas for these quantities are as follows:

circumference= 2πxthe square root of ( ( (a/2)^{2}+ (b/2)^{2 }) / 2 )

area= πab

where a and b are the lengths of the major and minor axes of the ellipse.

Project 1.5. Write a program to to input the radius of a sphere and then compute and output its the surface area and volume. The formulas for these quantities are as follows:surface area= 4πr^{2}

volume= (4/3)πr^{3}

where r is the radius of the sphere.

Turn the following things:

- This grade sheet.
- You OCD design.
- Your source program.
- The output from an execution of your program.

Lab Home Page | Lab Exercise

© 2003 by Prentice Hall. All rights reserved.

Report all errors to Jeremy D. Frens.