/// <summary> /// Creates an animal. /// </summary> /// <param name="chipRegistrationNumber">The chipnumber of the animal. /// Must be unique. Must be zero or greater than zero.</param> /// <param name="dateOfBirth">The date of birth of the animal.</param> /// <param name="name">The name of the animal.</param> protected Animal(int chipRegistrationNumber, SimpleDate dateOfBirth, string name) { if (name == null) { throw new ArgumentNullException("name"); } if (dateOfBirth == null) { throw new ArgumentNullException("dateOfBirth"); } if (name.Length == 0) { throw new ArgumentException("name"); } if (chipRegistrationNumber < 0) { throw new ArgumentOutOfRangeException("chipRegistrationNumber"); } ChipRegistrationNumber = chipRegistrationNumber; DateOfBirth = dateOfBirth; Name = name; IsReserved = false; }
/// <summary> /// Creates a dog. /// </summary> /// <param name="chipRegistrationNumber">The chipnumber of the animal. /// Must be unique. Must be zero or greater than zero.</param> /// <param name="dateOfBirth">The date of birth of the animal.</param> /// <param name="name">The name of the animal.</param> /// <param name="lastWalkDate">The date of the last walk with the dog or null if unknown.</param> public Dog(int chipRegistrationNumber, SimpleDate dateOfBirth, string name, SimpleDate lastWalkDate) : base(chipRegistrationNumber, dateOfBirth, name) { LastWalkDate = lastWalkDate; }
/// <summary> /// Get the tumber of days between this objects date and the given date. /// </summary> /// <param name="otherDate">The end date.</param> /// <returns>The number of days between this date and endDate.</returns> public int DaysDifference(SimpleDate otherDate) { TimeSpan timespan = otherDate.date.Subtract(date); return timespan.Days; }
/// <summary> /// Creates a cat. /// </summary> /// <param name="chipRegistrationNumber">The chipnumber of the animal. /// Must be unique. Must be zero or greater than zero.</param> /// <param name="dateOfBirth">The date of birth of the animal.</param> /// <param name="name">The name of the animal.</param> /// <param name="badHabits">The bad habbits of the cat (e.g. "scratches the couch") /// or null if none.</param> public Cat(int chipRegistrationNumber, SimpleDate dateOfBirth, string name, string badHabits) : base(chipRegistrationNumber, dateOfBirth, name) { BadHabits = badHabits; }
/// <summary> /// Get the tumber of days between this objects date and the given date. /// </summary> /// <param name="otherDate">The end date.</param> /// <returns>The number of days between this date and endDate.</returns> public int DaysDifference(SimpleDate otherDate) { TimeSpan timespan = otherDate.date.Subtract(date); return(timespan.Days); }