From: Bruce Wayner Date: 2010-08-19T02:57:01+09:00 Subject: Re: can i do this in ruby? a simulation process can someone edit my code: i've been trying to change the thing you said but it shows nothing. :( 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) $departure_Time = rand(36) $travel_Time= rand(71) $delay1 +=1 sleep($delay1) sleep($delay2) $passenger2= 1 $delay101 = rand(10) puts ("\nDeparture Time: #$departure_Time seconds"); puts ("Traveling Time: #$travel_Time 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; $departure_time2 = rand(36) $travel_time2 = rand(71) $passenger1=2 puts ("\nDeparture Time: #$departure_time2 seconds"); puts ("Traveling Time: #$travel_time2 seconds"); puts ("# of people Arrive in second city: #{$passenger1}"); puts ("Total Traveling Time: #$totalTravel"); end puts("# of people transfer:"); puts("Total Time:"); Cheers, -- Posted via http://www.ruby-forum.com/.