代码改变世界

职业倾向测试

2009-06-09 14:36  hailibu  阅读(213)  评论(0编辑  收藏  举报
private string GetTestResult()
        {
            //E:外倾 I:内倾 S:感觉 N:直觉 T:思维 F:情感 J:判断 P:直觉
            int Escore = 0, Iscore = 0, Sscore = 0, Nscore = 0, Tscore = 0, Fscore = 0, Jscore = 0, Pscore = 0;
            string[] result = new string[28];
            for (int i = 0; i < 28; i++)
            {
                result[i] = "B";
            }

            for (int i = 0; i < 28; i++)
            {
                if (i < 7)
                {
                    switch (result[i])
                    {
                        case "A":
                            Escore++; break;
                        case "B":
                            Iscore++; break;
                    }
                    continue;
                }
                if (7 <= i && i < 14)
                {
                    switch (result[i])
                    {
                        case "A":
                            Sscore++; break;
                        case "B":
                            Nscore++; break;
                    }
                    continue;
                }
                if (14 <= i && i < 21)
                {
                    switch (result[i])
                    {
                        case "A":
                            Tscore++; break;
                        case "B":
                            Fscore++; break;
                    }
                    continue;
                }
                if (21 <= i && i < 28)
                {
                    switch (result[i])
                    {
                        case "A":
                            Jscore++; break;
                        case "B":
                            Pscore++; break;
                    }
                    continue;
                }
            }

            return (Escore > Iscore ? "E" : "I") + (Sscore > Nscore ? "S" : "N") + (Tscore > Fscore ? "T" : "F") + (Jscore > Pscore ? "J" : "P");
        }