Example #1
0
        /// <summary>
        /// Gets digit's reference
        /// </summary>
        /// <param name="key">The character of the digit</param>
        /// <returns>Given digit's reference</returns>
        public Digit GetDigit(char key)
        {
            Digit digit = null;

            if (this.digits.ContainsKey(key))
            {
                digit = this.digits[key];
            }
            else
            {
                switch (key)
                {
                case '0':
                    digit = new Digit0();
                    break;

                case '1':
                    digit = new Digit1();
                    break;

                case '2':
                    digit = new Digit2();
                    break;

                case '3':
                    digit = new Digit3();
                    break;

                case '4':
                    digit = new Digit4();
                    break;

                case '5':
                    digit = new Digit5();
                    break;

                case '6':
                    digit = new Digit6();
                    break;

                case '7':
                    digit = new Digit7();
                    break;

                case '8':
                    digit = new Digit8();
                    break;

                case '9':
                    digit = new Digit9();
                    break;
                }

                this.digits.Add(key, digit);
            }

            return(digit);
        }
Example #2
0
 public string FinalOutPut()
 {
     return(Digit1.ToString() + Digit2.ToString() + Digit3.ToString() + Digit4.ToString());
 }