示例#1
0
        //public Dog(int chipRegistrationNumber, SimpleDate dateOfBirth,
        //         string name) : base(chipRegistrationNumber, dateOfBirth, name)
        //{
        //    LastWalkDate = null;
        //    Price = GetPrice();
        //}

        /// <summary>
        /// Retrieve information about this dog
        ///
        /// Note: Every class inherits (automagically) from the 'Object' class,
        /// which contains the virtual ToString() method which you can override.
        /// </summary>
        /// <returns>A string containing the information of this animal.
        ///          The format of the returned string is
        ///          "Dog: <ChipRegistrationNumber>, <DateOfBirth>, <Name>, <IsReserved>, <LastWalkDate>"
        ///          Where: IsReserved will be "reserved" if reserved or "not reserved" otherwise.
        ///                 LastWalkDate will be "unknown" if unknown or the date of the last doggywalk otherwise.
        /// </returns>
        public override string ToString()
        {
            string walked = LastWalkDate.ToString();

            if (walked == "01/01/1980" || walked == null)
            {
                walked = "Please Walk!";
            }

            return(base.ToString() + ", " + walked);
        }
示例#2
0
文件: Dog.cs 项目: grasmanek94/SE21
        /// <summary>
        /// Retrieve information about this dog
        ///
        /// Note: Every class inherits (automagically) from the 'Object' class,
        /// which contains the virtual ToString() method which you can override.
        /// </summary>
        /// <returns>A string containing the information of this animal.
        ///          The format of the returned string is
        ///          "Dog: <ChipRegistrationNumber>, <DateOfBirth>, <Name>, <IsReserved>, <LastWalkDate>"
        ///          Where: IsReserved will be "reserved" if reserved or "not reserved" otherwise.
        ///                 LastWalkDate will be "unknown" if unknown or the date of the last doggywalk otherwise.
        /// </returns>
        public override string ToString()
        {
            string toAppend = "unknown";

            if (LastWalkDate != null)
            {
                toAppend = LastWalkDate.ToString();
            }

            return("Dog: " + base.ToString() + ", " + toAppend);
        }
示例#3
0
        public override string ToString()
        {
            string lastWalkDate;

            if (LastWalkDate == null)
            {
                lastWalkDate = "Unknown";
            }
            else
            {
                lastWalkDate = LastWalkDate.ToString();
            }
            return("Dog: " + base.ToString() + ", " + lastWalkDate + ", " + Price); // Hoeft geen Price.ToString() dit is "redundant" dat houdt in dat de compiler al weet dat het hier om een string gaat
        }
示例#4
0
        /// <summary>
        /// Retrieve information about this dog
        ///
        /// Note: Every class inherits (automagically) from the 'Object' class,
        /// which contains the virtual ToString() method which you can override.
        /// </summary>
        /// <returns>A string containing the information of this animal.
        ///          The format of the returned string is
        ///          "Dog: <ChipRegistrationNumber>, <DateOfBirth>, <Name>, <IsReserved>, <LastWalkDate>"
        ///          Where: IsReserved will be "reserved" if reserved or "not reserved" otherwise.
        ///                 LastWalkDate will be "unknown" if unknown or the date of the last doggywalk otherwise.
        /// </returns>
        public override string ToString()
        {
            string info;
            string LastWalk;

            if (LastWalkDate == null)
            {
                LastWalk = "unknown";
            }
            else
            {
                LastWalk = LastWalkDate.ToString();
            }
            info = "Dog: " + base.ToString() + LastWalk;
            return(info);
        }
示例#5
0
        public override string ToString()
        {
            string lastWalkDateString;

            if (LastWalkDate == null)
            {
                lastWalkDateString = "Unknown";
            }
            else
            {
                lastWalkDateString = LastWalkDate.ToString();
            }

            string info = "Dog: " + base.ToString() + ", " + lastWalkDateString;

            return(info);
        }
示例#6
0
        public override string ToString()
        {
            string walk;

            if (LastWalkDate == null)
            {
                walk = "Please Walk!";
            }
            else
            {
                walk = LastWalkDate.ToString();
            }
            return("Dog: "
                   + base.ToString()
                   + ", "
                   + walk);
        }