//remove gum from dispenser
        public string RemoveGum()
        {
            Gum extractedgum = disp.Remove();

            string flavor = extractedgum.Flavor.ToString();

            return(flavor);
        }
Пример #2
0
        // Remove a gum from dispenser
        public Gum Remove()
        {
            if (gums.Count > 0)
            {
                Random rand    = new Random();
                int    randgum = rand.Next(0, gums.Count);

                Gum extractedGum = gums[randgum];
                gums.RemoveAt(randgum);
                Updatenumber();
                return(extractedGum);
            }
            else
            {
                return(null);
            }
        }