示例#1
0
        public FBResult GetResult(int i)
        {
            FBResult result = new FBResult(i, null);

            if (i % this.Divisor == 0)
            {
                result.FBValue = i;
                result.Text    = this.Message;
            }
            return(result);
        }
        public FBResult GetResult(int i)
        {
            FBResult result   = new FBResult(i, null);
            double   root     = Math.Sqrt(i);
            bool     isSquare = root % 1 == 0;

            if (isSquare)
            {
                result.Text = "Perfect Square!";
            }
            return(result);
        }
示例#3
0
        public FBResult GetResult(int i)
        {
            FBResult result    = new FBResult(i, null);
            string   normal    = i.ToString();
            string   backwards = new string(normal.Reverse().ToArray());

            if (normal == backwards)
            {
                result.Text = "Palindrome!";
            }
            return(result);
        }
示例#4
0
        public static FBResult GetResult(int i, List <IFBItem> fbitems)
        {
            FBResult result = new FBResult();

            foreach (var fbi in fbitems.OrderByDescending(fb => fb.OrderCheck))
            {
                FBResult fbresult = fbi.GetResult(i);
                result = fbresult;
                if (fbresult.Text != null)
                {
                    break;
                }
            }
            return(result);
        }
示例#5
0
        public FBResult[] GetResults()
        {
            var orderedItems = fbitems.OrderByDescending(fb => fb.OrderCheck);
            var result       = new FBResult[this.nums.Length];

            for (int i = 0; i < this.nums.Length; i++)
            {
                foreach (var fbi in orderedItems)
                {
                    FBResult fbresult = fbi.GetResult(nums[i]);
                    result[i] = fbresult;
                    if (fbresult.Text != null)
                    {
                        break;
                    }
                }
            }
            return(result);
        }