i already erase some codes: but the thing is how can i get the total 
number of seconds every time vehicle arrive in the second city.

Example:
Vehicle Number 1:
Departure Time: 3 seconds
Travel Time: 45seconds
# of people transfer: 1
Total Time Consume: 48 --> how can get that one

Vehicle Number 2:
Departure Time: 8 seconds
Travel Time: 35 seconds
# of people transfer: 2 ->(is it possible to store this one in an array
so that if Vehicle Number 2 reaches the 30% (150) of people transfer it 
will
compute for the total spent in transferring those people) how?
Total Time Consume: 43

and then if the loop reaches the last loop which is the bus
it will compute also the time etc..
also let say the there 50 already transferred that is less than 500 so 
there are 450 more how can i loop again so that it will loop again and 
it will give again 50people transfer until it reaches 500.. after 
reaching the 500 people it will calculate all the seconds consume... 
this is too complicated to understand i hope you get the point sorry...

Here is my code which i delete some stuff to make it little:
print "Number of Vehicle: " #That will be maximum of 5 only
n = gets().to_i

print "\n Vehicle number 1: "
 $delay1 = rand(4)
 $delay2 = rand(10)
 $depart = rand(36)
 $travelTime= rand(71)
 $ET = $depart
 $ET1= $travelTime
 $delay1 +=1
 sleep($delay1)
 sleep($delay2)
 $passenger2= 1
 $delay101 = rand(10)
 puts ("\nDeparture Time:  #$ET seconds");
 puts ("Traveling Time:  #$ET1 seconds");
 puts ("# of passenger Arrive in Second City: #{$passenger2}");
 puts ("Total Traveling Time:     #{$delay1} seconds");
  $i = 1+1;
  $num = n+1;

  while $i < $num  do

  puts ("\n Vehicle number: #{$i}");
  $i +=1;

  $depart1 = rand(36)
  $travelTime1 = rand(71)
  $ET = $depart1
  $ET1= $travelTime1
  $passenger1=2
     puts ("\nDeparture Time:  #$depart seconds");
     puts ("Traveling Time:  #$travelTime1 seconds");
    puts ("# of people Arrive in second city: #{$passenger1}");
    puts ("Total Traveling Time:  #$totalTravel");

  end
 puts("# of people transfer:");
 puts("Total Time:");
-- 
Posted via http://www.ruby-forum.com/.