コード例 #1
0
ファイル: Headmisstress.cs プロジェクト: Ariiia/LR62OP
        public static void ReceiptForParents()
        {
            if (Child.Days < 30)
            {
                Console.WriteLine("Not enough days to calculate price");
            }
            else
            {
                foreach (Child element in ChildCollectMi)
                {
                    int  sum = 0;
                    bool pay = true;
                    for (int i = 0; i < Child.Days; i++)
                    {
                        if (i % 30 < 10 && i > 30)
                        {
                            pay = false;

                            while (i % 30 < 10 && i > 30 && !pay && i < Child.Days - 1)
                            {
                                sum = ((element.Attend[i]) == "+") ? sum += cost : sum;
                                pay = ((new Random()).Next(7) == 1) ? true:false;
                                i++;
                            }

                            if (pay)
                            {
                                sum = 0;
                            }
                        }
                        if (!pay)
                        {
                            pay = ((new Random()).Next(7) == 1) ? true : false;
                            element.Attend[i] = "- PAY DEBTS FOR YOUR CHILD";
                            continue;
                        }

                        sum = ((element.Attend[i]) == "+") ? sum += cost : sum;
                    }
                    Sum.Add(sum);
                }
            }
            foreach (Child child in ChildCollectMi)
            {
                SickKidos.Add(new Child());
                for (int i = 0; i < Child.Days; i++)
                {
                    if (child.Attend[i].Contains("- PAY DEBTS FOR YOUR CHILD"))
                    {
                        SickKidos.InfoOnChildren[SickKidos.InfoOnChildren.Count - 1].Add(child.Attend[i]);
                    }
                    else
                    {
                        SickKidos.InfoOnChildren[SickKidos.InfoOnChildren.Count - 1].Add(" ");
                    }
                }
            }
        }
コード例 #2
0
ファイル: Nurse.cs プロジェクト: Ariiia/LR62OP
        public static void Check()
        {
            if (ChildCollectNu.InfoOnChildren.Count == 0)
            {
                Console.WriteLine("There are no children in the kindergarden");
            }
            else if (Child.Days <= 3)
            {
                Console.WriteLine("Not enough data to send to Nurse");
            }
            else
            {
                foreach (Child children in Child.MyBoys)
                {
                    for (int i = 3; i < Child.Days; i++)
                    {
                        if (children.needReceipt == true)
                        {
                            children.needReceipt = ((new Random()).Next(2) == 0) ? true : false;
                            children.Attend[i]   = ((children.needReceipt) == false) ? "+" : "- GO TO NURSE TAKE RECEIPT";
                            continue;
                        }

                        if ((children.Attend[i - 2] == "-") && (children.Attend[i - 1] == "-") && (children.Attend[i] == "-") && (children.Attend[i - 3] == "-"))
                        {
                            children.Attend[i - 2] = "- GO TO NURSE TAKE RECEIPT";
                            children.Attend[i - 1] = "- GO TO NURSE TAKE RECEIPT";
                            children.Attend[i]     = "- GO TO NURSE TAKE RECEIPT";
                            children.Attend[i - 3] = "- GO TO NURSE TAKE RECEIPT";
                            children.needReceipt   = true;
                            while (children.Attend[i] == "-")
                            {
                                children.Attend[i] = "- GO TO NURSE TAKE RECEIPT";
                                i++;
                            }


                            children.needReceipt = ((new Random()).Next(2) == 0) ? true : false;
                            children.Attend[i]   = "- GO TO NURSE TAKE RECEIPT";
                            continue;
                        }
                    }
                }
            }


            foreach (Child child in ChildCollectNu)
            {
                SickKidos.Add(new Child());
                for (int i = 0; i < Child.Days; i++)
                {
                    if (child.Attend[i].Contains("- GO TO NURSE TAKE RECEIPT"))
                    {
                        SickKidos.InfoOnChildren[SickKidos.InfoOnChildren.Count - 1].Add(child.Attend[i]);
                    }
                    else
                    {
                        SickKidos.InfoOnChildren[SickKidos.InfoOnChildren.Count - 1].Add(" ");
                    }
                }
            }
        }