first think what actuatlly happens in a queue, when there is no patient , counter is empty, first position is zero as its last position.
when a patient comes starting position as well as last position becomes 1.
now when 2nd patient comes last position is increased by 1 but starting position is fixed until that 1st guy is in the counter.
when more patients are to come all the time, last position will increase by 1.
when the work of 1st patient is over in the counter what happens he will leave the counter and the second patient will come to the counter i.e, starting position is increased by 1 in order to indicate the 2nd patient.
this is the starting area which you have to do, just think and do like that , if there will be any problem , post your problem with your code, we will surely help you...... :)