Hands On Java: Project 4


 

Objectives

1. Gain further experience defining methods.
2. Gain further experience using modules.
3. Gain experience working in groups.

 

Introduction

This week's project is to expand the number of methods provided by the metric module, as a four-person group project. Each group member is responsible for three different conversion methods.

Projects

Each of the following projects is to be the responsibility of a different member of your group. That person is responsible for adding the necessary prototypes and definitions to their own copy of module metric to provide the indicated functionality.

4.1.

Lengths

A. Inches to Centimeters (1 inch = 2.54 cm);
B. Yards to Meters (1 yard = 0.9144 m);
C. Miles to Kilometers (1 mile = 1.609344 km).

4.2.

Weights

D. Ounces to Grams (1 ounce = 28.349523 g);
E. Pounds to Kilograms (1 pound = 0.45359237 kg);
F. Tons to Kilograms 1 ton = 907.18474 kg).

4.3.

Volumes

G. Pints to Liters (1 pint = 0.473163 l);
H. Quarts to Liters (1 quart = 0.946326 l);
I. Gallons to Liters (1 gallon = 3.785306 l).

4.4.

Areas

J. Square Inches to Square Millimeters (1 sq. in. = 645.16 sq.mm);
K. Square Feet to Square Meters (1 sq. foot = 0.09290304 sq.m);
L. Acres to Square Meters (1 Acre = 4.04686 10^3 sq.m).

Each group member is to write the methods for which they are responsible on their own, without consulting anyone else. The group should then meet together to create a master documentation file containing documentation for all of the methods, a master implementation file containing all of the method definitions, and a master driver file containing all the testing code.

(Hint: Elect a group coordinator, and have each group member send their completed module and driver files to the coordinator via e-mail. The group can then assist the coordinator in the 'cut-and-paste' work needed to assemble the individual work into the master files. The coordinator can e-mail copies of the master files back to each of the participating group members.)

The master driver program should perform the following steps:

   0. Print a greeting.
   1. Prompt for, and input a real value, storing it in inVal;
   2. Output the result of calling method A with inVal as an argument;
   3. Output the result of calling method B with inVal as an argument;
	...
   N. Output the result of calling method L with inVal as an argument.

Your driver program should thus test each method in the module.

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

Turn In: A hard copy of this grade sheet, attached to hard copies of

  1. your driver program program;
  2. your two metric module files; and
  3. the output from three executions of your driver program using the input values: 3.666667, 16.5, and 256.

Don't forget to clean up when you are all finished...


Back to the Lab Table of Contents

Back to the Lab Exercise


Back to the Table of Contents

Back to the Introduction


Copyright 2000 by Prentice Hall. All rights reserved.