Project 5


You are to complete the metric library started in the lab exercise by expanding it to include the conversions in the following table assigned by your instructor. You must also expand the driver program from the lab exercise to test these new conversions.

You should follow the pattern in the lab exercise: first, design using OCD; then code your design in C++ using stepwise translation; finally, test your modified metric library by adding to your driver program.

Project #5.1: Expand the metric library started in the exercise to include the conversions in the following table:

Lengths Weights
Inches to centimeters
(1 inch = 2.54 cm)
Yards to meters
(1 yard = 0.9144 m)
Miles to kilometers
(1 mile = 1.609344 km)
Ounces to grams
(1 ounce = 28.349523 g)
Pounds to kilograms
(1 pound = 0.453592 kg)
Tons to kilograms
(1 ton = 907.18474 kg)
Volumes Areas
Pints to liters
(1 pint = 0.473163 l)
Quarts to liters
(1 quart = 0.946326 l)
Gallons to liters
(1 gallon = 3.785306 l)
Square inches to square millimeters
(1 sq. in. = 645.16 sq.mm)
Square feet to square meters
(1 sq. foot = 0.09290304 sq.m)
Acres to square meters
(1 Acre = 4.04686x10^3 sq.m).

Each person is responsible for writing the necessary function prototypes, definitions, and documentation specifications. Each person should write up an OCD design for at least one of their functions.

Each group, though, should submit exactly one library, bringing together all of the prototypes, definitions, and documentations (in three separate files, of course).

Then one of the people in the group (under the close scrutiny of the other group members) should extend the driver from the lab exercise to test all of the functions with one input value.

The documentation file should indicate which group member was responsible for which functions. Only that group member will be penalized for any errors in that set of functions, or its documentation.


Back to the Lab Exercise

Back to This Lab's Home Page


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