
public class Server
{
    private static int nextID = 1;
	private int serverID;
	private int endTime;
	private Customer serving;
	
	/**
	 * Constructs a server with the next available server ID.
	 */
	public Server()
	{
	    serverID = nextID;
	    nextID++;
	    endTime = 0;
	    serving = null;
	}
	
	/**
	 * Accessor method for getting the server ID number.
	 *   @return the server ID
	 */
	public int getID()
	{
	    return serverID;
	}
	
	/**
	 * Assigns a customer to the server and begins the transaction.
	 *   @param c the new customer to be served
	 *   @param time the time at which the transaction begins
	 */
	public void startCustomer(Customer c, int time)
	{
	    serving = c;
	    endTime = time + c.getJobLength();
	}
	
	/**
	 * Accessor method for getting the current customer.
	 *   @return the current customer, or null if no customer
	 */
	public Customer getCustomer()
	{
        return serving;
	}

    /**
     * Identifies the time at which the server will finish with
     * the current customer
     *   @return time at which transaction will finish, or 0 if no customer
     */
	public int busyUntil()
	{
	    return endTime;
	}
	
	/**
	 * Finishes with the current customer and resets the time to completion.
	 */
	public void finishCustomer()
	{
	    serving = null;
	    endTime = 0;
	}
}
