Beispiel #1
0
        public static void AppendCustomerToLine()
        /// function that accepts a reference of the super market line, and append a customer to the line if it meets the requirements.
        /// if the customer join the line, a random shopping list is generated for him
        /// <input>
        /// by ValidatedID, ValidatedBodyHeat, IsMaskOn and ShouldBeIsolated methods on PersonHandler Class
        /// </input>
        /// <output>
        /// outputs by the GetInLine outputs in SuperMarketQueue class
        /// </output>
        {
            // start getting the information about the customer - ID, name, body heat, mask on, isolated
            Console.WriteLine("Please provide the following information");
            Console.Write("Enter customer`s full name: ");
            string   FullName = Console.ReadLine();
            string   cust_ID  = PersonHandler.ValidatedID();
            double   bh       = PersonHandler.ValidateBodyHeat();
            bool     mask     = PersonHandler.IsMaskOn();
            bool     isolate  = PersonHandler.ShouldBeIsolated();
            Customer c        = new Customer(FullName, cust_ID, bh, mask, isolate);

            GetInLine(c);
            if (mask && isolate == false && PersonHandler.IsSick(bh) == false)
            {
                CustomerHandler.GenerateRandomShoppingList(c);
            }
        }
Beispiel #2
0
        /// <summary>
        /// The method creates 3 Employees, 6 Customers, 4 Cash Registers, 6 Product types and many products.
        /// </summary>
        public static void CreateObjectsForDebug()
        {
            CashRegister CRegister1 = new CashRegister("1");
            CashRegister CRegister2 = new CashRegister("2");
            CashRegister CRegister3 = new CashRegister("3");
            CashRegister CRegister4 = new CashRegister("4");

            Console.WriteLine("Cash reg created");


            ProductType Yogo = new ProductType("Yogurt", 6.99, "111");

            Inventory.Instance.AddProductType(Yogo);
            ProductType Koteg = new ProductType("Koteg", 7.99, "222");

            Inventory.Instance.AddProductType(Koteg);
            ProductType Antrikot = new ProductType("Antrikot", 129.99, "333");

            Inventory.Instance.AddProductType(Antrikot);
            ProductType Tea = new ProductType("Tea Box", 25.00, "444");

            Inventory.Instance.AddProductType(Tea);
            ProductType Tomatoes = new ProductType("Tomatoes", 3.99, "555");

            Inventory.Instance.AddProductType(Tomatoes);
            ProductType Zero = new ProductType("Coca Cola Zero", 2.99, "666");

            Inventory.Instance.AddProductType(Zero);

            Console.WriteLine("Product Types Created");


            Customer c1 = new Customer("Amit Assa", "11", 36.5, true, false);

            SuperMarketQueueBL.GetInLine(c1);
            CustomerHandler.GenerateRandomShoppingList(c1);
            Customer c2 = new Customer("Dana Assa", "12", 34.5, true, false);

            SuperMarketQueueBL.GetInLine(c2);
            CustomerHandler.GenerateRandomShoppingList(c2);
            Customer c3 = new Customer("Dor Assa", "13", 37.2, false, true);

            SuperMarketQueueBL.GetInLine(c3);
            CustomerHandler.GenerateRandomShoppingList(c3);
            Customer c4 = new Customer("Chen Assa", "14", 38.3, true, false);

            SuperMarketQueueBL.GetInLine(c4);
            Customer c5 = new Customer("Mike Assa", "15", 36.0, true, true);

            SuperMarketQueueBL.GetInLine(c5);
            CustomerHandler.GenerateRandomShoppingList(c5);
            Customer c6 = new Customer("Shay Assa", "16", 32.1, true, false);

            SuperMarketQueueBL.GetInLine(c6);
            CustomerHandler.GenerateRandomShoppingList(c6);

            Console.WriteLine("Customers Created");


            Employee emp  = new Employee("Yossi", "999");
            Employee emp2 = new Employee("Tanya", "998");
            Employee emp3 = new Employee("Lily", "997");

            Console.WriteLine("Employees created");


            CreateProductsDebug();
        }