static void Main(string[] args) { Corporate parkwood = new Corporate("Parkwood Entertainment"); Subunit marketing = new Subunit(1, "Marketing"); Subunit arts = new Subunit(2, "Artists & Repertoire"); Subunit brands = new Subunit(3, "Brands"); Subunit smed = new Subunit(4, "Social media marketing"); Subunit tv = new Subunit(5, "TV marketing"); WhiteCollar bey = new WhiteCollar("Beyonce", "Knowles", "CEO", "4/09/1981", true); WhiteCollar jlo = new WhiteCollar("Jennifer", "Lopez", "Singer", "24/07/1969", false); WhiteCollar emgad = new WhiteCollar("Emin", "Gadzhiev", "Marketing specialist", "22/01/2000", false); marketing.AddSubUnit(smed); marketing.AddSubUnit(tv); arts.AddEmployee(bey); arts.AddEmployee(jlo); smed.AddEmployee(emgad); emgad.SetHead(); parkwood.AddDepartments(marketing); parkwood.AddDepartments(arts); parkwood.AddDepartments(brands); Console.WriteLine(parkwood.CorpName + " Hierarachy"); foreach (Subunit subunit in parkwood.Departments) { PrintUnitInfo(subunit, 3); } Console.ReadLine(); }
public static void PrintUnitInfo(Subunit subun, int indent) { Console.Write(new String(' ', indent)); Console.WriteLine(subun.UnitName); indent++; foreach (Subunit depart in subun.SubUnits) { PrintUnitInfo(depart, indent); } }
public void AddDepartments(Subunit depname) { Departments.Add(depname); }
public void AddSubUnit(Subunit sunitname) { SubUnits.Add(sunitname); }