/// <summary>
        /// Calculates final time till all customers are served.
        /// </summary>
        /// <param name="registerSet"></param>
        /// <param name="grocery"></param>
        /// <returns></returns>
        private static int finaltime(RegisterFunctions registerSet, Grocery grocery)
        {
            int time = 1;

            while (!(customerQueue.Count() == 0) || registerSet.getRegisterstatus())
            {
                List <Customer> customersAtSameTime = new List <Customer>();
                GroceryHelper.getCustomersArrivingSameTime(customersAtSameTime, time);
                customersAtSameTime.Sort();
                registerSet.serviceCustomer(customersAtSameTime);
                int index = 0;
                while (index < registerSet.getRegisterList().Count())
                {
                    Queue <Customer> customer = registerSet.getRegisterList()[index].getCustomers();
                    if (index == registerSet.getRegisterList().Count() - 1)
                    {
                        GroceryHelper.traineeServe(customer);
                    }
                    else
                    {
                        GroceryHelper.expertServe(customer);
                    }
                    index++;
                }
                time++;
            }
            return(time);
        }
        static void Main(string[] args)
        {
            Grocery           grocery     = GroceryHelper.readFromfile(args);
            RegisterFunctions registerSet = grocery.getRegisterFunctons();
            int time = finaltime(registerSet, grocery);

            Console.WriteLine("Finished at: t = " + time + " minutes");
            // Console.ReadLine();
        }