The project will be submitted electronically through WebCT. Zip up your entire project folder for submission. (Right click on the project folder, follow the Send To link and select Compressed (zipped) Folder.) Once the compression process is done, you will have a zipped file with the same name as your project folder and an extension of .zip. This zipped file will be uploaded to the WebCT system during project submission. The project folder should include the following files:
You have been asked to write a program that performs some unit conversions from the metric system (the International System of Units) to U.S. units. The first project will focus on converting from meters to inches, feet, yards, and miles. One yard is defined to be equal to 0.9144 meters (NIST Guide to SI Units - Appendix B. Conversion Factors). Converting to inches, feet, and miles can be performed based on knowing that 12 inches equals a foot, 3 feet equals a yard, and 1760 yards equals a mile. For example, to convert 1000 meters (a kilometer) to a mile.
The first step divides by 0.9144 because 1 yard = 0.9144 meters implies that 1 meter = (1 / 0.9144) yards. Similarly, 1 mile = 1760 yards implies that 1 yard = (1 / 1760) miles.
Although the class has an instance field for the unit of the measurement, the methods in this project will assume that the unit is meters.
Instance fields:myNumber - a double value representing the number of the measurementConstructors:
myUnit - a String value representing the unit of the measurement
/* The constructor has two parameters: */Methods:
/* the number and the unit of the measurement. */
public Length(double number, String unit)
/* getInches returns the number of inches */
public double getInches()/* getFeet returns the number of feet */
public double getFeet()/* getYards returns the number of yards */
public double getYards()/* getMiles returns the number of miles */
public double getMiles()/* setNumber sets the number of the measurement to a new value */
public void setNumber(double number)/* setUnit sets the unit of the measurement to a new value */
public void setUnit(String unit)/* toString returns a string describing the measurement. */
public String toString()