Steven Boss wrote:
> Just to Clarify:
> 
> An Ambulance are dispatched at a rate of one every 15sec to 10 minutes 
> in a
> large metropolitan area. 15% of the calls are false alarm
> which requires 12sec to 2 minutes to complete. All other calls can be 
> one of
> two kinds. First kind are classified as serious. They constitute 15% of
> the non-false alarm calls and take 25sec to 5 minutes to complete. The
> remaining call take 20sec to 10 minutes to complete. Assume that there 
> are
> very large number of available ambulance, and that any number can be on
> call at any time. Write a program that would simulate the system???s 500
> call to be completed.
> 
> Ok so i need to loop numbers from 1 -500 for the ambulance
> then set a three type of calls
>    -> False Alarm Calls (it takes 12sec to 2 minutes to process the 
> calls)
>    -> Non-False Alarm Calls (it takes 25sec to 5 minutes to process the 
> calls)
>    -> Normal Calls (it takes 20sec to 10 minutes)
> 
> after getting a call i need to add the dispatch rate of an ambulance for 
> 15sec to 10minutes
> Example i'll put it in a Table:
> Ambulance # / Time(Call Received)/Time(Process Request)/Call Type/Time 
> Dispatch / Total Time
> 
> em i correct sir?

As I said before, I'd replicate exactly what you'd do on paper. For 
example, I suspect that on each piece of paper you'd mark the time which 
the call arrived, the type of call it was, and the time it took to 
complete (or end time).

Re-reading the question, it is still highly ambiguous. It starts by 
saying that an ambulance is *dispatched* every N seconds, and I would 
imagine that each ambulance is only dispatched in response to a call. 
But presumably you would not dispatch an ambulance in response to a 
"false alarm" call? So does it actually mean that a call is received 
every N seconds, rather that an ambulance is dispatched every N seconds?

Or you are supposed to estimate the rate of incoming calls, working 
backwards from the rate of ambulance dispatch and the proportion of 
non-false alarms?

Another interpretation is that every call results in an ambulance being 
dispatched, and the crew decide it's a false alarm only once they've 
arrived and assessed the situation. But then, all calls would take the 
same amount of time to process, since you wouldn't know at call time 
whether it was a false alarm or not.
-- 
Posted via http://www.ruby-forum.com/.