示例#1
0
        public float TuborgVol()
        {
            Alcohol tuborgInfo = new Alcohol();

            for (int i = 0; i < tuborgArray.Length; i++)
            {
                if (tuborgArray[i] != null)
                {
                    tuborgInfo = tuborgArray[i];
                    i          = tuborgArray.Length + 1;
                }
            }
            float tuborgVolReturn = tuborgInfo.Vol;

            return(tuborgVolReturn);
        }
示例#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;
            }
        }