Пример #1
0
        public Supplier()
        {
            // Generate Random Name
            NameGenerator nameGenerator = new NameGenerator();
            this.name = nameGenerator.GenRandomLastName();

            //
            // Generate Random Starting Inventory
            //
            int minStartingQuantity = 5;
            int maxStartingQuantity = 15;
            System.Threading.Thread.Sleep(100);
            Random random = new Random();
            // Lemons

            int generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {

                lemonInventory.add(new Lemon());
            }
            // Sugar
            generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient lemon = new Lemon();
                this.lemonInventory.add(lemon);
            }
            // Sugar
            generateQuantity = random.Next(1,15);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient sugar = new Sugar();
                sugarInventory.add(sugar);
            }
            // Ice
            generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient ice = new Ice();
                iceInventory.add(ice);
            }
            // Cups
            generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient cups = new Cups();
                cupInventory.add(cups);
            }

            // Generate Random Price List ??
            // STUB Hard Code STUB
            int basePrice = 1;
            int minVariance = 10;
            int maxVariance = 100;
            this.lemonSalePrice = basePrice + (random.Next(minVariance, maxVariance)/100f);
            this.sugarSalePrice = basePrice + (random.Next(minVariance, maxVariance)/100f);
            this.iceSalePrice = basePrice + (random.Next(minVariance, maxVariance)/100f);
            this.cupSalePrice = basePrice + (random.Next(minVariance, maxVariance)/100f);

            // Generate Random Cash on Hand
            int minStartingCash = 600;
            int maxStartingCash = 1400;
            this.cashOnHand = random.Next(minStartingCash, maxStartingCash);
        }
Пример #2
0
        public Supplier()
        {
            // Generate Random Name
            NameGenerator nameGenerator = new NameGenerator();

            this.name = nameGenerator.GenRandomLastName();

            //
            // Generate Random Starting Inventory
            //
            int minStartingQuantity = 5;
            int maxStartingQuantity = 15;

            System.Threading.Thread.Sleep(100);
            Random random = new Random();
            // Lemons

            int generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);

            for (int i = 0; i < generateQuantity; i++)
            {
                lemonInventory.add(new Lemon());
            }
            // Sugar
            generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient lemon = new Lemon();
                this.lemonInventory.add(lemon);
            }
            // Sugar
            generateQuantity = random.Next(1, 15);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient sugar = new Sugar();
                sugarInventory.add(sugar);
            }
            // Ice
            generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient ice = new Ice();
                iceInventory.add(ice);
            }
            // Cups
            generateQuantity = random.Next(minStartingQuantity, maxStartingQuantity);
            for (int i = 0; i < generateQuantity; i++)
            {
                Ingredient cups = new Cups();
                cupInventory.add(cups);
            }


            // Generate Random Price List ??
            // STUB Hard Code STUB
            int basePrice   = 1;
            int minVariance = 10;
            int maxVariance = 100;

            this.lemonSalePrice = basePrice + (random.Next(minVariance, maxVariance) / 100f);
            this.sugarSalePrice = basePrice + (random.Next(minVariance, maxVariance) / 100f);
            this.iceSalePrice   = basePrice + (random.Next(minVariance, maxVariance) / 100f);
            this.cupSalePrice   = basePrice + (random.Next(minVariance, maxVariance) / 100f);

            // Generate Random Cash on Hand
            int minStartingCash = 600;
            int maxStartingCash = 1400;

            this.cashOnHand = random.Next(minStartingCash, maxStartingCash);
        }