Project 1


Objectives

1. Practice designing a program.
2. Practice implementing a program design in C++.
3. Practice testing a program.

Introduction

Your instructor may assign you one or more of the problems below. To solve it, follow the pattern in the lab exercise for designing and writing a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Also, test your program thoroughly.

The Projects

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

Project #1.1: Write a program to input the radius of a circle and then compute its circumference and area. The formulas for these quantities are as follows:
circumference = 2πr
area = πr2
where r is the radius of the circle. Output, with appropriate labels, the radius, the circumference, and the area.

Project #1.2: Write a program to input the radius of the circular base and the height of a right circular cylinder and then compute its surface area and volume. The formulas for these quantities are as follows:

surface area = 2πrh
volume = π r2h
where r is the radius of the circular bases of the cylinder and h is its height. Output, with appropriate labels, the base radius, the height, the surface area, and the volume.

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

area = πab
where a and b are the lengths of the semi-major and semi-minor axes (halves of the axes) of the ellipse. Output, with appropriate labels, the major axis, the minor axis, the circumference, and the area.

Project #1.4: Write a program to to input the radius of a sphere and then compute its surface area and volume. The formulas for these quantities are as follows:
surface area = 4π r2
volume = (4/3)πr3
where r is the radius of the sphere. Output, with appropriate labels, the radius, the surface area, and the volume.


Back to the Lab Exercise

Back to This Lab's Home Page


Report errors to Larry Nyhoff (nyhl@cs.calvin.edu)