Ejemplo n.º 1
0
        public string AppleType()
        {
            Juice appleInfo = new Juice();

            for (int i = 0; i < appleArray.Length; i++)
            {
                if (appleArray[i] != null)
                {
                    appleInfo = appleArray[i];
                    i         = appleArray.Length + 1;
                }
            }
            string appleTypeReturn = appleInfo.Type;

            return(appleTypeReturn);
        }
Ejemplo n.º 2
0
        //---------------------------------------------------------------------------------------------------
        //Restocking all the arrays with new objects
        public void restock()
        {
            //restocking or filling the array up with the obj
            for (int i = 0; i < colaArray.Length; i++)
            {
                //making a new obj
                Soda cola = new Soda("cola", 20, 500, 1, false);
                //putting the obj in the array
                colaArray[i] = cola;
            }

            //----------------------------------------------------------
            //the same as the above but for the diffrent obj and arrays
            //----------------------------------------------------------

            for (int i = 0; i < tuborgArray.Length; i++)
            {
                Alcohol tuborg = new Alcohol("Tuborg", 25, 333, 1, 4.5f);
                tuborgArray[i] = tuborg;
            }
            for (int i = 0; i < appleArray.Length; i++)
            {
                Juice appleJuice = new Juice("Apple Juice", 15, 125, 0, "Apple");
                appleArray[i] = appleJuice;
            }
            for (int i = 0; i < havSaltArray.Length; i++)
            {
                Snack havSalt = new Snack("Kims Havsalt", 20, 150, "Chips");
                havSaltArray[i] = havSalt;
            }
            for (int i = 0; i < hariboArray.Length; i++)
            {
                Snack haribo = new Snack("Haribo", 25, 250, "gummies");
                hariboArray[i] = haribo;
            }
        }