using System;
class MainClass {
public static void Main(string[] args) {
Address addr = new Address();
addr.SetStreet(123, "My Street");
addr.SetCity("A", "X", 123456);
Console.WriteLine(addr.GetStreetString());
Console.WriteLine(addr.GetCityString());
addr.Output();
}
}
class Address {
public int nAddressNumberPart;
public string sAddressNamePart;
public string sCity;
public string sState;
public int nPostalCode;
public void SetStreet(int nNumber, string sName) {
nAddressNumberPart = nNumber;
sAddressNamePart = sName;
}
public string GetStreetString() {
return nAddressNumberPart + " " + sAddressNamePart;
}
public void SetCity(string sCityIn, string sStateIn, int nPostalCodeIn) {
sCity = sCityIn;
sState = sStateIn;
nPostalCode = nPostalCodeIn;
}
public string GetCityString() {
return sCity + ", " + sState + " " + nPostalCode;
}
public string GetAddressString() {
return GetStreetString() + "\n" + GetCityString();
}
public void Output() {
Console.WriteLine(GetAddressString());
}
}
|