I suspect it's because of this code block here.
private void doServiceComplete()
{
if(sim.notBeingServed() == true)
{
System.out.println("No customer is being served at the present time"
+ " of " + sim.getTime() + ".");
}
else
{
System.out.print("Customer " + sim.getCurCust().toString() +
" finished at time " + sim.getTime() + ". Number waiting" +
" is ");
System.out.println(sim.getNumWaiting() + ".");
}
sim.serviceComplete();
}
When you get to sim.getNumWaiting()
your people waiting will be one less than you're expecting. sim.serviceComplete()
has peopleCompleted++
which is performed AFTER you print your results. You should move this to the beginning of the method, or somewhere else logical, before sim.getNumWaiting()
is called.
Example:
private void doServiceComplete()
{
sim.serviceComplete();
if(sim.notBeingServed() == true)
{
System.out.println("No customer is being served at the present time"
+ " of " + sim.getTime() + ".");
}
else
{
System.out.print("Customer " + sim.getCurCust().toString() +
" finished at time " + sim.getTime() + ". Number waiting" +
" is ");
System.out.println(sim.getNumWaiting() + ".");
}
}