예제 #1
0
        /// <summary>
        /// this function convert the license number of the bus to string
        /// </summary>
        /// <returns>the license number as a string</returns>
        public string LicToString()
        {
            string strLic = LicNum.ToString();

            if (strLic.Length == 7)
            {
                strLic = strLic.Insert(2, "-");
                strLic = strLic.Insert(6, "-");
            }
            else
            {
                strLic = strLic.Insert(3, "-");
                strLic = strLic.Insert(6, "-");
            }
            return(strLic);
        }
예제 #2
0
        /// <summary>
        /// This function prints the bus's license numbber and the Km since last treatment.
        /// </summary>
        public void print()
        {
            string strLic = LicNum.ToString();

            if (strLic.Length == 7)
            {
                strLic = strLic.Insert(2, "-");
                strLic = strLic.Insert(6, "-");
            }
            else
            {
                strLic = strLic.Insert(3, "-");
                strLic = strLic.Insert(6, "-");
            }
            Console.WriteLine("{0} drove {1} Km since last treatment.", strLic, KmFromtreat);
        }