namespace pop { using ArgumentException = System.ArgumentException; using Object = System.Object; using String = System.String; public class PersonImpl: Person { private String iName; private Date iDateOfBirth; private String iPhoneNumber; private double iHeight; public PersonImpl(Person pPerson) { PersonImpl tPersonImpl = (PersonImpl)pPerson; iName = tPersonImpl.iName; iDateOfBirth = new DateImpl(tPersonImpl.iDateOfBirth); iPhoneNumber = tPersonImpl.iPhoneNumber; iHeight = tPersonImpl.iHeight; } public PersonImpl(string pPersonString) { try { string[] tokens = pPersonString.Split(new char[] {'%'}); if (tokens.Length!=4) { throw new ArgumentException(); } iName = tokens[0]; iDateOfBirth = new DateImpl(tokens[1]); iPhoneNumber = tokens[2]; iHeight = double.Parse(tokens[3]); } catch { iName = "Joe"; iDateOfBirth = new DateImpl(1970, 1, 1); iPhoneNumber = "0"; iHeight = 0.0; // throw new ArgumentException("illegal person"); } } public PersonImpl(String pName, Date pDateOfBirth, String pPhoneNumber, double pHeight) { iName = pName; iDateOfBirth = new DateImpl(pDateOfBirth); iPhoneNumber = pPhoneNumber; iHeight = pHeight; } public String Name { get { return iName; } set { iName = value; } } public Date DateOfBirth { get { return iDateOfBirth; } set { iDateOfBirth = value; } } public String PhoneNumber { get { return iPhoneNumber; } set { iPhoneNumber = value; } } public double Height { get { return iHeight; } set { iHeight = value; } } public override bool Equals(Object pObject) { PersonImpl tPersonImpl = (PersonImpl)pObject; return iName.Equals(tPersonImpl.iName); } public override int GetHashCode() { return 0; } public int CompareTo(object pObject) { PersonImpl tPersonImpl = (PersonImpl)pObject; return iName.CompareTo(tPersonImpl.iName); } public override String ToString() { return iName + "%" + iDateOfBirth + "%" + iPhoneNumber + "%" + iHeight; } } }