protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "除法练习";
            this.examTitle        = "除法测验";
            this.flowDocumentFile = "SoonLearning.Math.Arithmetic_Division.DivisionFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   0,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
                                                                     "填空题:",
                                                                     "(找出算式中的加数,和)",
                                                                     5,
                                                                     0,
                                                                     10));

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
                                                                     "表格题:",
                                                                     "(从表格中选择符合条件的算式)",
                                                                     5,
                                                                     0,
                                                                     10));
        }
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "乘法结合律练习";
            this.examTitle        = "乘法结合律测验";
            this.flowDocumentFile = "Math.Basic.Data.ArithmeticLaws.AssociativeLawOfMultiplicationFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   0,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
            //    "填空题:",
            //    "(按照乘法结合律填空)",
            //    5,
            //    0,
            //    10));

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
            //    "表格题:",
            //    "(从表格中选择符合乘法结合律条件的等式)",
            //    5,
            //    0,
            //    10));
        }
示例#3
0
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "减法的性质练习";
            this.examTitle        = "减法的性质测验";
            this.flowDocumentFile = "SoonLearning.Assessment.Player.Data.ArithmeticLaws.CharacterOfSubtractionFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   0,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
            //    "填空题:",
            //    "(按照减法的性质填空)",
            //    5,
            //    0,
            //    10));

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
            //    "表格题:",
            //    "(从表格中选择符合减法的性质条件的等式)",
            //    5,
            //    0,
            //    10));
        }
示例#4
0
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "加法交换律练习";
            this.examTitle        = "加法交换律测验";
            this.flowDocumentFile = "SoonLearning.Assessment.Data.ArithmeticLaws.CommutativeLawOfAdditionFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   0,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
                                                                     "填空题:",
                                                                     "(按照加法交换律填空)",
                                                                     5,
                                                                     0,
                                                                     10));

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
                                                                     "表格题:",
                                                                     "(从表格中选择符合加法交换律条件的等式)",
                                                                     5,
                                                                     0,
                                                                     10));
        }
示例#5
0
        private void CreateFIBQuestion(SectionBaseInfo sectionInfo, Section section)
        {
            int minValue = 10;
            int maxValue = 100;

            if (sectionInfo is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            if (section.QuestionCollection.Count == 0)
            {
                questionValueList.Clear();
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            int value = 0;

            while (true)
            {
                value = rand.Next(minValue, maxValue);
                if (Enumerable.Where <int>(questionValueList, (c => (c == value))).Count <int>() > 0)
                {
                    Thread.Sleep(10);
                    continue;
                }
                break;
            }

            questionValueList.Add(value);

            string questionText = string.Format("写出自然数{0}的所有正约数。", value);

            FIBQuestion fibQuestion = new FIBQuestion();

            fibQuestion.Content.Content     = questionText;
            fibQuestion.Content.ContentType = ContentType.Text;
            fibQuestion.ShowBlankInContent  = false;
            section.QuestionCollection.Add(fibQuestion);

            for (int j = 1; j <= value; j++)
            {
                if (value % j == 0)
                {
                    QuestionBlank blank = new QuestionBlank();

                    QuestionContent blankContent = new QuestionContent();
                    blankContent.Content     = j.ToString();
                    blankContent.ContentType = ContentType.Text;
                    blank.ReferenceAnswerList.Add(blankContent);

                    fibQuestion.QuestionBlankCollection.Add(blank);

                    fibQuestion.Content.Content += blank.PlaceHolder;
                }
            }
        }
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "除法的性质练习";
            this.examTitle        = "除法的性质测验";
            this.flowDocumentFile = "Math.Basic.Data.ArithmeticLaws.CharacterOfDivisionFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   1,
                                                                   100);

            this.sectionInfoCollection.Add(info);

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
            //    "填空题:",
            //    "(按照除法的性质填空)",
            //    5,
            //    0,
            //    10));

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
            //    "表格题:",
            //    "(从表格中选择符合除法的性质条件的等式)",
            //    5,
            //    0,
            //    10));
        }
示例#7
0
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "乘法练习";
            this.examTitle        = "乘法测验";
            this.flowDocumentFile = "SoonLearning.Assessment.Player.Data.Arithmetic.MultiplicationFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   0,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
                                                                     "填空题:",
                                                                     "(找出算式中的加数,和)",
                                                                     5,
                                                                     0,
                                                                     10));

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
            //    "表格题:",
            //    "(从表格中选择符合条件的算式)",
            //    5,
            //    0,
            //    10));
        }
示例#8
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            if (minValue < 10)
            {
                minValue = 10;
            }

            if (maxValue > 1000)
            {
                maxValue = 1000;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;// rand.Next(3, 6);
            valueABC.answer = 0;

            //decimal A1, A2 = 0;

            //int times = rand.Next(1, 10);
            int a1 = 0;                // rand.Next(1, 10); //百位数
            int b1 = rand.Next(1, 10); //十位数
            int c1 = rand.Next(1, 10); //个位数
            int a2 = 1;                // rand.Next(1, 10); //百位数
            int b2 = 0;                // rand.Next(0, 10); //十位数
            int c2 = rand.Next(1, 10); //个位数
            int d1 = 0;
            int d2 = 0;

            decimal A1 = 0, A2 = 0;
            int     posRand = rand.Next(0, 2);

            valueABC.posMul = posRand;

            if (posRand == 0)
            {
                A1 = rand.Next(minValue, maxValue); // 1000 * d1 + 100 * a1 + 10 * b1 + c1;
                A2 = 99;                            // 1000 * d2 + 100 * a2 + 10 * b2 + c2;
                valueABC.answer = A1 * A2 + A1;
            }
            else
            {
                A2 = rand.Next(minValue, maxValue); //1000 * d1 + 100 * a1 + 10 * b1 + c1;
                A1 = 11;                            // 1000 * d2 + 100 * a2 + 10 * b2 + c2;
                valueABC.answer = A2 * A1 - A2;
            }

            valueABC.values[0] = A1;
            valueABC.values[1] = A2;
        }
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "乘法分配率练习";
            this.examTitle        = "乘法分配率测验";
            this.flowDocumentFile = "SoonLearning.Math.ArithmeticLaws_DistributiveLawOfMultiplication.DistributiveLawOfMultiplicationFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   0,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
                                                                     "填空题:",
                                                                     "(按照乘法分配率填空)",
                                                                     5,
                                                                     0,
                                                                     10));

            this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
                                                                     "表格题:",
                                                                     "(从表格中选择符合乘法分配率条件的等式)",
                                                                     5,
                                                                     0,
                                                                     10));
        }
示例#10
0
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "方程的解练习";
            this.examTitle        = "方程的解测验";
            this.flowDocumentFile = "Math.Basic.Data.Equation.SolutionOfEquationFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   1,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
            //    "填空题:",
            //    "(按照方程的解填空)",
            //    5,
            //    0,
            //    10));

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
            //    "表格题:",
            //    "(从表格中选择符合方程的解条件的等式)",
            //    5,
            //    0,
            //    10));
        }
        protected override void PrepareSectionInfoCollection()
        {
            this.exerciseTitle    = "方程的定义练习";
            this.examTitle        = "方程的定义测验";
            this.flowDocumentFile = "SoonLearning.Assessment.Player.Data.Equation.DefinitionOfEquationFlowDocument.xaml";

            SectionValueRangeInfo info = new SectionValueRangeInfo(QuestionType.MultiChoice,
                                                                   "单选题:",
                                                                   "(下面每道题都只有一个选项是正确的)",
                                                                   5,
                                                                   1,
                                                                   10);

            this.sectionInfoCollection.Add(info);

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.FillInBlank,
            //    "填空题:",
            //    "(按照方程的定义填空)",
            //    5,
            //    0,
            //    10));

            //this.sectionInfoCollection.Add(new SectionValueRangeInfo(QuestionType.Table,
            //    "表格题:",
            //    "(从表格中选择符合方程的定义条件的等式)",
            //    5,
            //    0,
            //    10));
        }
示例#12
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //if (minValue < 1000)
            {
                minValue = 10;
            }

            //if (maxValue < 10000)
            {
                maxValue = 100;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;
            valueABC.answer = 0;

            decimal A, B;
            int     a = rand.Next(1, 10);
            int     b = rand.Next(1, 10);
            int     c = a;
            int     d = 9 - b;

            while (true)
            {
                d = rand.Next(1, 10);
                if (b + d < 10)
                {
                    break;
                }
            }
            A = 10 * a + b;
            B = 10 * c + d;

            //int posRand = rand.Next(0, 2);
            //if (posRand == 0)
            //{
            //    A = 10 * a + b;
            //    B = 10 * c + d;
            //}
            //else
            //{
            //    B = 10 * a + b;
            //    A = 10 * c + d;
            //}

            valueABC.values[0] = A;
            valueABC.values[1] = B;
            valueABC.answer    = A * B;
        }
示例#13
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //if (minValue < 1000)
            {
                minValue = 100;
            }

            //if (maxValue < 10000)
            {
                maxValue = 10000;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;
            valueABC.answer = 0;

            decimal A, B;
            int     bitNum = rand.Next(3, 5); //一百零几或一千零几
            int     a      = rand.Next(1, 10);
            int     b      = rand.Next(1, 10);

            if (bitNum == 3) //一百零几
            {
                A = 100 + a;
                B = 100 + b;
            }
            else
            {
                A = 1000 + a;
                B = 1000 + b;
            }

            //int posRand = rand.Next(0, 2);
            //if (posRand == 0)
            //{
            //    A = 10 * a + b;
            //    B = 10 * c + d;
            //}
            //else
            //{
            //    B = 10 * a + b;
            //    A = 10 * c + d;
            //}

            valueABC.values[0] = A;
            valueABC.values[1] = B;
            valueABC.answer    = A * B;
        }
示例#14
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            if (minValue < 10)
            {
                minValue = 10;
            }

            if (maxValue < 1000)
            {
                maxValue = 1000;
            }

            Random rand   = new Random((int)DateTime.Now.Ticks);
            int    number = 3; //rand.Next(3, 5 + 1);

            valueABC.number = number;
            valueABC.answer = 0;

            int     i   = 0;
            int     tmp = 0;
            decimal sum = 0;

            int B       = rand.Next(maxValue, maxValue + 1);
            int C       = rand.Next(minValue, maxValue + 1);
            int maxHbit = 10;

            if (maxValue > 1000)
            {
                maxHbit = 100;
            }

            int baseNumB = rand.Next(11, 100);
            int baseNumC = rand.Next(11, 100);
            int hBitB    = rand.Next(0, maxHbit);
            int hBitC    = rand.Next(0, maxHbit);

            B = hBitB * 100 + baseNumB;
            C = hBitC * 100 + baseNumC;

            int hBitA = rand.Next(hBitB + hBitC + 1, maxHbit + hBitB + hBitC + 1);
            int A     = hBitA * 100 + baseNumC;

            //
            valueABC.values[0] = A;
            valueABC.values[1] = B;
            valueABC.values[2] = C;

            valueABC.answer = A - B - C;
        }
示例#15
0
        private void CreateFIBQuestion(SectionBaseInfo info, Section section)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            decimal valueA = rand.Next(minValue, maxValue);

            Thread.Sleep(10);
            decimal valueB = rand.Next(minValue, maxValue);

            decimal result = valueA + valueB;

            this.questionValueList.Add(result);

            string questionText = string.Format("{0} + {1} = ", valueA, valueB);

            FIBQuestion fibQuestion = new FIBQuestion();

            fibQuestion.Content.Content     = questionText;
            fibQuestion.Content.ContentType = ContentType.Text;
            fibQuestion.ShowBlankInContent  = true;

            QuestionBlank blankA = new QuestionBlank();

            blankA.MatchOwnRefAnswer = true;
            QuestionContent blankContentA = new QuestionContent();

            blankContentA.Content     = valueB.ToString();
            blankContentA.ContentType = ContentType.Text;
            blankA.ReferenceAnswerList.Add(blankContentA);
            fibQuestion.QuestionBlankCollection.Add(blankA);
            fibQuestion.Content.Content += blankA.PlaceHolder;

            fibQuestion.Content.Content += " + ";

            QuestionBlank blankB = new QuestionBlank();

            blankB.MatchOwnRefAnswer = true;
            QuestionContent blankContentB = new QuestionContent();

            blankContentB.Content     = valueA.ToString();
            blankContentB.ContentType = ContentType.Text;
            blankB.ReferenceAnswerList.Add(blankContentB);
            fibQuestion.QuestionBlankCollection.Add(blankB);
            fibQuestion.Content.Content += blankB.PlaceHolder;

            fibQuestion.Solution.Content = string.Format("交换两个加数{0}和{1}的位置, 结果是{1}和{0}。", valueA, valueB, result);

            section.QuestionCollection.Add(fibQuestion);
        }
示例#16
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 100;
            int maxValue = 1000;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            if (minValue < 100)
            {
                minValue = 100;
            }

            if (maxValue < 500)
            {
                maxValue = 500;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;// rand.Next(4, 8 + 1);
            int a, b, c;

            //取a和b
            while (true)
            {
                //取a, b
                a = rand.Next(1, 9 + 1);
                b = rand.Next(1, 9 + 1);
                c = rand.Next(1, 9 + 1);

                if (a + c == 2 * b && a != c)
                {
                    valueABC.a = a;
                    valueABC.b = b;
                    valueABC.c = c;
                    break;
                }
            }

            if (100 * a + 10 * b + c > 100 * c + 10 * b + a)
            {
                valueABC.values[0] = 100 * a + 10 * b + c;
                valueABC.values[1] = 100 * c + 10 * b + a;
            }
            else
            {
                valueABC.values[1] = 100 * a + 10 * b + c;
                valueABC.values[0] = 100 * c + 10 * b + a;
            }


            valueABC.answer = valueABC.values[0] - valueABC.values[1]; // +valueABC.values[2] + valueABC.values[3] + valueABC.values[4] + valueABC.values[5];
        }
示例#17
0
        private void CreateTableQuestion(SectionBaseInfo sectionInfo, Section section)
        {
            Random rand = new Random((int)DateTime.Now.Ticks);

            int minValue = 0;
            int maxValue = 100;

            if (sectionInfo is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            string questionText = string.Format("请下表中选出所有的纯小数。");

            StringBuilder strBuilder    = new StringBuilder();
            TableQuestion tableQuestion = ObjectCreator.CreateTableQuestion((content) =>
            {
                content.Content     = questionText;
                content.ContentType = ContentType.Text;
                return;
            },
                                                                            () =>
            {
                List <QuestionOption> optionList = new List <QuestionOption>();

                for (int k = 0; k < 36; k++)
                {
                    int rand0 = rand.Next(0, 3);
                    if (rand0 == 0)
                    {
                        foreach (QuestionOption temp in ObjectCreator.CreateDoubleOption(0, 0, minValue + 1, maxValue))
                        {
                            temp.IsCorrect = true;
                            optionList.Add(temp);

                            this.CreateSolution(strBuilder, temp);
                        }
                    }
                    else
                    {
                        foreach (QuestionOption temp in ObjectCreator.CreateDoubleOption(minValue + 1, maxValue, minValue, maxValue))
                        {
                            optionList.Add(temp);
                            this.CreateSolution(strBuilder, temp);
                        }
                    }
                }

                return(optionList);
            });

            tableQuestion.Solution.Content = strBuilder.ToString();
            tableQuestion.Tip = this.CreateTip();

            section.QuestionCollection.Add(tableQuestion);
        }
示例#18
0
        private void CreateTableQuestion(SectionBaseInfo info, Section section)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            string questionText = "从表格中选择符合减法的性质条件的等式";

            TableQuestion tableQuestion = ObjectCreator.CreateTableQuestion((content) =>
            {
                content.Content     = questionText;
                content.ContentType = ContentType.Text;
                return;
            },
                                                                            () =>
            {
                List <QuestionOption> optionList = new List <QuestionOption>();

                for (int j = 0; j < 36; j++)
                {
                    if (rand.Next() % 2 == 0) // Create correct Option
                    {
                        decimal valueA               = rand.Next(minValue, maxValue + 1);
                        decimal valueB               = rand.Next(minValue, maxValue + 1);
                        QuestionOption option        = new QuestionOption();
                        option.IsCorrect             = true;
                        option.OptionContent.Content = string.Format("{0}×{1}={1}×{0}", valueA, valueB);
                        optionList.Add(option);
                    }
                    else
                    {
                        decimal valueA               = rand.Next(minValue, maxValue + 1);
                        decimal valueB               = rand.Next(minValue, maxValue + 1);
                        decimal valueC               = rand.Next(minValue, decimal.ToInt32(valueA + valueB + 1));
                        decimal valueD               = valueA + valueB - valueC;
                        QuestionOption option        = new QuestionOption();
                        option.IsCorrect             = (valueC == valueB) ? true : false;
                        option.OptionContent.Content = string.Format("{0}×{1}={2}×{3}", valueA, valueB, valueC, valueD);
                        optionList.Add(option);
                    }
                }

                return(optionList);
            }
                                                                            );

            //   tableQuestion.Solution.Content = string.Format("加数{0}与加数{1}的和是{2},所以正确答案是{2}。", valueA, valueB, result);

            section.QuestionCollection.Add(tableQuestion);
        }
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //if (minValue < 1000)
            {
                minValue = 10;
            }

            //if (maxValue < 10000)
            {
                maxValue = 100;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;
            valueABC.answer = 0;

            decimal A, B;
            int     a = rand.Next(1, 10);
            int     b = 5; // rand.Next(1, 10);
            int     d = 5; // a - 1;
            int     c = rand.Next(1, 10);

            if ((a + c) % 2 == 0 && (a + c) != 18)
            {
                if (a != 9)
                {
                    a++;
                }
                else
                {
                    c++;
                }
            }
            else if (a + c == 18)
            {
                a--;
            }


            A = 10 * a + b;
            B = 10 * c + d;

            valueABC.values[0] = A;
            valueABC.values[1] = B;
            valueABC.answer    = A * B;
        }
示例#20
0
        private void CreateMCQuestion(SectionBaseInfo sectionInfo, Section section)
        {
            Random rand = new Random((int)DateTime.Now.Ticks);

            int    divValue     = 2;//rand.Next(2, 9);
            string questionText = string.Format("请选出是偶数的数。");

            MCQuestion mcQuestion = ObjectCreator.CreateMCQuestion((content) =>
            {
                content.Content     = questionText;
                content.ContentType = ContentType.Text;
                return;
            },
                                                                   () =>
            {
                List <QuestionOption> optionList = new List <QuestionOption>();
                int minValue = 10;
                int maxValue = 100;
                if (sectionInfo is SectionValueRangeInfo)
                {
                    SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                    minValue = decimal.ToInt32(rangeInfo.MinValue);
                    maxValue = decimal.ToInt32(rangeInfo.MaxValue);
                }
                foreach (QuestionOption option in ObjectCreator.CreateDecimalOptions(
                             4, minValue, maxValue, false, (c => ((c % divValue) == 0))))
                {
                    optionList.Add(option);
                }

                return(optionList);
            }
                                                                   );

            section.QuestionCollection.Add(mcQuestion);

            StringBuilder strBuilder = new StringBuilder();

            foreach (QuestionOption option in mcQuestion.QuestionOptionCollection)
            {
                QuestionContent content = option.OptionContent;
                decimal         value   = System.Convert.ToDecimal(content.Content);
                if (value == 0)
                {
                    strBuilder.AppendLine(string.Format("0 不是奇数,也不是偶数。"));
                }
                else if (value % divValue == 0)
                {
                    strBuilder.AppendLine(string.Format("{0}除以{1}等于{2},没有余数,是正确答案。", value, divValue, value / divValue));
                }
                else
                {
                    strBuilder.AppendLine(string.Format("{0}除以{1}等于{2},余数是{3}。", value, divValue, (int)(value) / divValue, value % divValue));
                }
            }
            mcQuestion.Solution.Content = strBuilder.ToString();
        }
示例#21
0
        private void GetRandomValues(SectionBaseInfo info,
                                     ref int valueA, ref int valueB, ref int valueC, ref int valueM, ref int valueN, ref int sign)
        {
            int minValue = 50;
            int maxValue = 500;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            if (maxValue < 100)
            {
                maxValue = 100;
            }

            Random rand     = new Random((int)DateTime.Now.Ticks);
            int    valueTmp = 0;

            while (true)
            {
                valueA   = rand.Next(minValue, maxValue + 1);
                valueTmp = rand.Next(100, maxValue + 1);
                valueM   = valueTmp / 10;
                valueN   = rand.Next(1, 9 + 1);

                if (valueN > 5)
                {
                    sign = 1; //负号
                }
                else
                {
                    sign = 0; //正号
                }

                if (sign == 0) //正号
                {
                    valueB = valueM * 10 + valueN;
                }
                else //负号
                {
                    valueB  = valueM * 10 + valueN;
                    valueM += 1;
                    valueN  = 10 - valueN;
                }

                valueC = valueA + valueB;

                if (valueB > 0)
                {
                    break;
                }
            }
        }
示例#22
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            if (minValue < 10)
            {
                minValue = 10;
            }

            if (maxValue < 10000)
            {
                maxValue = 10000;
            }

            Random rand   = new Random((int)DateTime.Now.Ticks);
            int    number = rand.Next(3, 5 + 1);

            if (number % 2 == 0)
            {
                number++;
            }
            valueABC.number = number;
            valueABC.answer = 0;

            int     i = 0, i2 = 0;
            int     tmp     = 0;
            int     baseNum = 100;
            decimal sum     = 0;

            //取互为补数的数组
            for (i = 1; i < number; i++)
            {
                valueABC.values[i] = rand.Next(10, baseNum);
                i++;
                valueABC.values[i] = baseNum - valueABC.values[i - 1];
                tmp = rand.Next(0, 10);
                valueABC.values[i - 1] += tmp * baseNum;
                tmp = rand.Next(0, 10);
                valueABC.values[i] += tmp * baseNum;
                sum += valueABC.values[i - 1] + valueABC.values[i];
            }

            //取被减数
            valueABC.values[0] = rand.Next(decimal.ToInt32(sum) + 1, decimal.ToInt32(sum) + maxValue + 1);

            valueABC.answer = valueABC.values[0] - sum;
        }
        private Section CreateFIBSection(SectionBaseInfo sectionInfo, BackgroundWorker worker)
        {
            Section fibSection = ObjectCreator.CreateSection(sectionInfo.Name, sectionInfo.Description);

            int minValue = 0;
            int maxValue = 10 + 1;

            if (sectionInfo is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            List <int> questionValueList = new List <int>();
            Random     rand = new Random((int)DateTime.Now.Ticks);

            int valueA = 0, valueB = 0;

            for (int i = 0; i < sectionInfo.QuestionCount; i++)
            {
                int[] value = new int[2];
                valueA = rand.Next(minValue, maxValue + 1);
                valueB = rand.Next(minValue + 1, maxValue + 1);

                string questionText = string.Format("写出小数{0}.{1}的整数部分和小数部分", valueA, valueB);

                FIBQuestion fibQuestion = new FIBQuestion();
                fibQuestion.Content.Content     = questionText;
                fibQuestion.Content.ContentType = ContentType.Text;
                fibSection.QuestionCollection.Add(fibQuestion);

                value[0] = valueA;
                value[1] = valueB;

                for (int j2 = 0; j2 < 2; j2++)
                {
                    QuestionBlank blank = new QuestionBlank();

                    QuestionContent blankContent = new QuestionContent();
                    blankContent.Content     = value[j2].ToString();
                    blankContent.ContentType = ContentType.Text;
                    blank.ReferenceAnswerList.Add(blankContent);

                    fibQuestion.QuestionBlankCollection.Add(blank);

                    fibQuestion.Content.Content += blank.PlaceHolder;
                }

                worker.ReportProgress(0, fibQuestion);
            }

            return(fibSection);
        }
示例#24
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 1;
            int maxValue = 9;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //只适用于两位数相减
            if (minValue < 1)
            {
                minValue = 1;
            }

            if (maxValue > 9)
            {
                maxValue = 9;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;// rand.Next(4, 8 + 1);

            valueABC.answer = 0;

            decimal[] tmpValues      = new decimal[valueABC.number];
            int[]     tmpComplements = new int[valueABC.number];
            int       tmpNumber      = valueABC.number;

            int a, b;

            //取a和b
            while (true)
            {
                //取a, b=99
                b = 99;// rand.Next(1, 8 + 1);
                a = rand.Next(2, 9 + 1);

                valueABC.valuesRef[0] = a;
                valueABC.valuesRef[1] = b;
                valueABC.values[0]    = a;
                valueABC.values[1]    = b;

                //if (a != b)
                {
                    break;
                }
            }
            valueABC.answer = valueABC.values[0] * valueABC.values[1];
        }
示例#25
0
        private void CreateTableQuestion(SectionBaseInfo sectionInfo, Section section)
        {
            // Table Question

            int minValue = 10;
            int maxValue = 100;

            if (sectionInfo is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            int inMinValue = 2, inMaxValue = 2;

            if (minValue / 10 > inMinValue)
            {
                inMinValue = minValue / 10;
            }
            inMaxValue = maxValue / 10;

            Random rand = new Random((int)DateTime.Now.Ticks);

            int divValue = rand.Next(2, 10);
            //int divValue = rand.Next(inMinValue, inMaxValue);
            string questionText = string.Format("请下表中选出是{0}倍数的数。", divValue);

            TableQuestion tableQuestion = ObjectCreator.CreateTableQuestion((content) =>
            {
                content.Content     = questionText;
                content.ContentType = ContentType.Text;
                return;
            },
                                                                            () =>
            {
                List <QuestionOption> optionList = new List <QuestionOption>();

                foreach (QuestionOption option in ObjectCreator.CreateDecimalOptions(
                             36, minValue, maxValue, true, (c => ((c % divValue) == 0))))
                {
                    optionList.Add(option);
                }

                return(optionList);
            });

            tableQuestion.Solution.Content = this.CreateSolution(divValue);

            section.QuestionCollection.Add(tableQuestion);
        }
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //if (minValue < 1000)
            {
                minValue = 10;
            }

            //if (maxValue < 10000)
            {
                maxValue = 100;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;
            valueABC.answer = 0;

            decimal A, B;
            int     a = rand.Next(2, 10);
            int     b = rand.Next(2, 10);
            int     c = a - 1;
            int     d = 11 - b;

            int posRand = rand.Next(0, 2);

            if (posRand == 0)
            {
                A = 10 * a + b;
                B = 10 * c + d;
            }
            else
            {
                B = 10 * a + b;
                A = 10 * c + d;
            }

            valueABC.values[0] = A;
            valueABC.values[1] = B;
            valueABC.answer    = A * B;
        }
示例#27
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //if (minValue < 1000)
            {
                minValue = 10;
            }

            //if (maxValue < 10000)
            {
                maxValue = 100;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;
            valueABC.answer = 0;

            decimal A, B;
            int     a = rand.Next(1, 10);
            int     b = 1; // rand.Next(1, 10);
            int     c = 1; // rand.Next(1, 10);
            int     d = rand.Next(1, 10);

            //if (a > c)
            //{
            //    c = a - 1;
            //}
            //else
            //{
            //    c = a + 1;
            //}

            B = 10 * a + b;
            A = 10 * c + d;

            valueABC.values[0] = A;
            valueABC.values[1] = B;
            valueABC.answer    = A * B;
        }
示例#28
0
        private void GetRandomValues(SectionBaseInfo info, ref valuesStruct valueABC)
        {
            int minValue = 10;
            int maxValue = 100;

            if (info is SectionValueRangeInfo)
            {
                SectionValueRangeInfo rangeInfo = info as SectionValueRangeInfo;
                minValue = decimal.ToInt32(rangeInfo.MinValue);
                maxValue = decimal.ToInt32(rangeInfo.MaxValue);
            }

            //if (minValue < 1000)
            {
                minValue = 100;
            }

            //if (maxValue < 10000)
            {
                maxValue = 100000;
            }

            Random rand = new Random((int)DateTime.Now.Ticks);

            valueABC.number = 2;
            valueABC.answer = 0;

            decimal A1, A2 = 0;

            int baseNum = 11;
            int a       = 0;
            int b       = rand.Next(1, 10);
            int bitNum  = rand.Next(3, 5);

            if (bitNum == 3)
            {
                A2 = b * 100 + b * 10 + b * 10 + b;
            }
            else if (bitNum == 4)
            {
                A2 = b * 1000 + b * 100 + b * 10 + b * 100 + b * 10 + b;
            }

            A1 = rand.Next(100, 1000);

            valueABC.values[0] = A1;
            valueABC.values[1] = A2;
            valueABC.answer    = A1 * A2;
        }
示例#29
0
        private void CreateTableQuestion(SectionBaseInfo sectionInfo, Section section)
        {
            // Table Question
            Random rand = new Random((int)DateTime.Now.Ticks);

            string questionText = string.Format("请下表中选出是质数的数。");

            TableQuestion tableQuestion = ObjectCreator.CreateTableQuestion((content) =>
            {
                content.Content     = questionText;
                content.ContentType = ContentType.Text;
                return;
            },
                                                                            () =>
            {
                List <QuestionOption> optionList = new List <QuestionOption>();
                int minValue = 10;
                int maxValue = 100;
                if (sectionInfo is SectionValueRangeInfo)
                {
                    SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                    minValue = decimal.ToInt32(rangeInfo.MinValue);
                    maxValue = decimal.ToInt32(rangeInfo.MaxValue);
                }
                foreach (QuestionOption option in ObjectCreator.CreateDecimalOptions(
                             36, minValue, maxValue, true,
                             (c) =>
                {
                    for (int j = 2; j < c / 2 + 1; j++)
                    {
                        if (c % j == 0)
                        {
                            return(false);
                        }
                    }
                    return(true);
                }))
                {
                    optionList.Add(option);
                }

                return(optionList);
            });

            tableQuestion.Tip = this.CreateTip();

            section.QuestionCollection.Add(tableQuestion);
        }
        private Section CreateTableSection(SectionBaseInfo sectionInfo, BackgroundWorker worker)
        {
            // Table Question
            Section sectionTable = ObjectCreator.CreateSection(sectionInfo.Name, sectionInfo.Description);

            Random rand = new Random((int)DateTime.Now.Ticks);

            for (int i = 2; i < sectionInfo.QuestionCount + 2; i++)
            {
                int    divValue     = i;
                string questionText = string.Format("请下表中选出能被{0}公倍数的数。", divValue);

                TableQuestion tableQuestion = ObjectCreator.CreateTableQuestion((content) =>
                {
                    content.Content     = questionText;
                    content.ContentType = ContentType.Text;
                    return;
                },
                                                                                () =>
                {
                    List <QuestionOption> optionList = new List <QuestionOption>();
                    int minValue = 10;
                    int maxValue = 100;
                    if (sectionInfo is SectionValueRangeInfo)
                    {
                        SectionValueRangeInfo rangeInfo = sectionInfo as SectionValueRangeInfo;
                        minValue = decimal.ToInt32(rangeInfo.MinValue);
                        maxValue = decimal.ToInt32(rangeInfo.MaxValue);
                    }
                    foreach (QuestionOption option in ObjectCreator.CreateDecimalOptions(
                                 36, minValue, maxValue, true, (c => ((c % divValue) == 0))))
                    {
                        optionList.Add(option);
                    }

                    return(optionList);
                });

                tableQuestion.Solution.Content = this.CreateSolution(divValue);

                sectionTable.QuestionCollection.Add(tableQuestion);

                worker.ReportProgress(0, tableQuestion);
            }

            return(sectionTable);
        }