コード例 #1
0
            public void CreateSteps(int num)
            {
                string s;
                int    numSections;
                short  numQuestions;

                for (int i = 0; i < num; i++)
                {
                    Step tab = new Step(i + 1);
                    Console.WriteLine("Enter tab label:");
                    s = Console.ReadLine();

                    tab.Label = s;
                    if (s.Equals("Details"))
                    {
                        tab.AddDetailsSection();
                        tab.AddAddressSection();
                    }
                    else
                    {
                        Console.WriteLine("How many sections in tab {0}?", i + 1);
                        s           = Console.ReadLine();
                        numSections = Convert.ToInt16(s);
                        for (int k = 0; k < numSections; k++)
                        {
                            Section section = new Section();
                            tab.Questions.Add(section);
                            Console.WriteLine("How many question in section {0}?", k + 1);
                            s            = Console.ReadLine();
                            numQuestions = Convert.ToInt16(s);
                            section.AddQuestionsToSection(numQuestions);
                        }
                    }
                    steps.Add(tab);
                }
            }