Dear all,
I seem to have a small problem. I have an Air Traffic Control Application, with two runways which I am to synchronize in java. This is to be done because, if there is a plane two that lands while plane one is in the process of landing, it(plane two) does not have to wait but can quickly move to the runway two to land.
I have successfully synchronized one runway and I use one ArrayList
to store the plane details and the landing works, however landing of plane two will have to wait(about 5 seconds). Any ideas as to, how to synchronize two runways ?
My present idea was to have two ArrayLists
(one ArrayList(Even)
stores even numbered planes, eg. plane two, plane four) and another ArrayList(Odd)
stores odd numbered planes, e.g. plane one, plane three. Then I can make ArrayList (Even)
to work with runway one and ArrayList (Odd)
to work with runway two(using the individual synchronizaion technique I have done for runway one). The Downside is that, if I add 2 odd numbered planes in ArrayList Odd
and 20 even numbered planes in ArrayList
, when runway two becomes free, it would not be used. Instead only runway one would be used and the even numbered planes would have to wait.
Side note: I do understand that if both runways are occupied, the third plane will have to wait, but this is acceptable according to the markscheme.
Any suggestions ?
Thank you