function airplane_seat_test ( )

%*****************************************************************************80
%
%% airplane_seat_test() tests airplane_seat().
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    08 January 2022
%
%  Author:
%
%    John Burkardt
%
  fprintf ( 1, '\n' );
  fprintf ( 1, 'airplane_seat_test():\n' );
  fprintf ( 1, '  Airline passengers 1 to N are assigned seats 1 to N.\n' );
  fprintf ( 1, '  The first passenger to board, #1, is clueless, \n' );
  fprintf ( 1, '  and chooses a seat randomly.\n' );
  fprintf ( 1, '  The remaining passengers board in order, choosing their\n' );
  fprintf ( 1, '  assigned seat if possible, otherwise taking an empty\n' );
  fprintf ( 1, '  seat at random.\n' );
  fprintf ( 1, '\n' );
  fprintf ( 1, '  What is the probability that the last passenger, N, \n' );
  fprintf ( 1, '  will be able to sit in the correct assigned seat N?\n' );

  trial_num = 100000;
  n = 100;

  prob = airplane_seat ( trial_num, n );

  fprintf ( 1, '\n' );
  fprintf ( 1, '  Number of seats available = %d\n', n );
  fprintf ( 1, '  Number of simulations = %d\n', trial_num );
  fprintf ( 1, '  Estimated probability   = %8.6g\n', prob );
  fprintf ( 1, '  Theoretical probability = %8.6g\n', 0.5 );

  return
end
