function cities_test02 ( prefix )

%*****************************************************************************80
%
%% cities_test02() tests main_read_size(), dms_read(), dms_to_dist().
%
%  Discussion:
%
%    Get the DMS coordinates of a set of cities, and compute
%    the city-to-city distance table, using distances on a sphere.
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    19 May 2016
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    string PREFIX, the common file prefix.
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'cities_test02():\n' );
  fprintf ( 1, '  Get the DMS coordinates of a set of cities.\n' );
  fprintf ( 1, '  Compute the city-to-city distance table,\n' );
  fprintf ( 1, '  assuming the cities lie on a sphere (the earth).\n' );

  main_filename = sprintf ( '%s_main.txt', prefix );
  dms_filename = sprintf ( '%s_dms.txt', prefix );
  dist_filename = sprintf ( '%s_dist.txt', prefix );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The main filename is "%s".\n', main_filename );
  fprintf ( 1, '  The dms filename is "%s"\n', dms_filename );
  fprintf ( 1, '  The distance filename will be "%s".\n', dist_filename );

  n = main_read_size ( main_filename );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  The number of data items is %d\n', n );

  [ lat_dms, lon_dms ] = dms_read ( dms_filename, n );

  dms_print ( n, lat_dms, lon_dms, '  The longitude/latitude data:' );

  dist = dms_to_dist ( n, lat_dms, lon_dms );

  dist(1:n,1:n) = round ( dist(1:n,1:n) );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Distance from Atlanta to Boston  = ', dist(12,34) );
  fprintf ( 1, '  Road distance is 1037\n' );
  fprintf ( 1, '  Distance from Boston to Chicago  = ', dist(34,58) );
  fprintf ( 1, '  Road distance is  963\n' );
  fprintf ( 1, '  Distance from Chicago to Atlanta = ', dist(58,12) );
  fprintf ( 1, '  Road distance is  674\n' );

  r8mat_write ( dist_filename, n, n, dist );

  return
end
