- Exercises

In this exercise, you will extend the MyDistance class from the example in the previous lesson.

We'll cover the following

Task 1

Extend MyDistance from the previous example to support the following units:

  1. Feet (ft)

    • 1ft=0.3048m1 ft = 0.3048m
  2. Mile (mi)

    • 1mi=1609.344m1 mi = 1609.344 m

Tip: Define a good suffix for these units as well.

Get hands-on with 1200+ tech skills courses.