//key will be the name of the food converted to ASCII, value will be quanitity of food as an int
        public int get(string keyString)
        {
            int key = keyString.GetHashCode();
            //hash fuction using
            int hash = (key % TABLE_SIZE);

            if (table[hash] == null)
            {
                return(-1);
            }
            else
            {
                LinkedHashEntry entry = table[hash];
                while (entry != null && entry.getKey() != key)
                {
                    entry = entry.getNext();
                }
                if (entry == null)
                {
                    return(-1);
                }
                else
                {
                    return(entry.getValue());
                }
            }
        }
        //find method will find the key and will help determine if we should increment the value of a key or add a new item
        public bool find(string userKey)
        {
            int key  = userKey.GetHashCode();
            int hash = (key % TABLE_SIZE);

            if (hash < 0) //if the has value is negative, make it positive
            {
                hash *= -1;
            }
            if (table[hash] != null)
            {
                LinkedHashEntry entry = table[hash];

                while (entry.getNext() != null && entry.getKey() != key)
                {
                    entry = entry.getNext();
                }

                if (entry.getKey() == key)
                {
                    //increments value by one
                    int value = entry.getValue();
                    entry.setValue(value++);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            else
            {
                return(false);
            }
        }
        //method puts has table elements into an array and then calls mergesort
        public void printSorted()
        {
            LinkedHashEntry entry = table[0];

            int[] toBeSorted = new int[TABLE_SIZE]; //array to store hashtable values
            int   count      = 0;                   //keeps track of array placement

            //adds all elements into an array
            while (entry != null && entry.getNext() != null)
            {
                toBeSorted[count] = entry.getValue();
                entry             = entry.getNext();
                count++;
            }

            //sorts array
            Mergesort m      = new Mergesort();
            int       left   = 0;
            int       right  = toBeSorted.Length;
            int       middle = (left + right) / 2;

            m.MergeSortMain(toBeSorted, left, right, middle);

            //prints entries
            for (int i = 0; i < toBeSorted.Length; i++)
            {
                Console.WriteLine(toBeSorted[i]);
            }

            /* while (entry.getNext() != null)
             * {
             *   entry = entry.getNext();
             *   Console.WriteLine(entry);
             * }
             */
        }