Exercise 5.2. Distance for numeric and categorical attributes implemented as specified.