internal static void Display(BoatLicense lic) { WriteLine("Boat #{0} from {1} has a {2} HP motor.", lic.LicenseNum, lic.State, lic.MotorSizeInHP); WriteLine(" The price for the license is {0}\n", lic.Price.ToString("C2")); }
static void Main(string[] args) { const int STARTINGNUM = 201601; BoatLicense[] license = new BoatLicense[3]; int x; for (x = 0; x < license.Length; ++x) { license[x] = new BoatLicense(); license[x].LicenseNum = ("" + x + STARTINGNUM); } license[0].State = "WI"; license[1].State = "MI"; license[2].State = "MN"; license[0].MotorSizeInHP = 30; license[1].MotorSizeInHP = 50; license[2].MotorSizeInHP = 100; for (x = 0; x < license.Length; ++x) { Display(license[x]); } }