Skip to content

Distance

Eli Orona edited this page Dec 3, 2019 · 5 revisions

Distance

The Distance class is used to represent distance in the program. Its base unit is meters, but can be converted to any distance type (i.e. inches, feet, etc.).

There are two different ways > to create a Distance:

Create a Distance based on a meter value: Distance oneMeter = new Distance(1);

Create a Distance based on a DistanceUnit value: Distance tenInches = new Distance(10, DistanceUnits.INCH);