add demo code for task 3 of distance calculation