static void Main(string[] args) { University un = new University(); /* un.Init_Chem("Chemistry", "Aslam", 500); * * un.Init_Comp("CS and IT", "Saad", 200); */ un.AddDepartment("Chemistry", "Zain", Dep.chem, 700); un.AddDepartment("CS and IT", "Saad", Dep.comp, 450); foreach (var item in un.departments) { if (item is ChemDep) { //Cast ChemDep chem = (ChemDep)item; Console.WriteLine("Department Name : {0} Director : {1}, Student Number{2}", chem.Name, chem.Director, chem.NumberofStudents); } else if (item is CompDep) { //Cast CompDep comp = (CompDep)item; Console.WriteLine("Department Name : {0} Director : {1}, Student Number{2}", comp.Name, comp.Director, comp.Numberofcomp); } } Console.ReadLine(); }
/// <summary> /// Entry Point /// </summary> static void Main() { University bsu = new University(); Department rpct = new Faculty("RPCT", "Minsk", "Kurchatova", "5"); Department rpctCopy = new Faculty("RPCT", "Minsk", "Kurchatova", "5"); Department management = new Management("Management", "Moscow", "Pushkina", "Colotushkina"); Department managementButDifferentType = new Institute("Management", "Moscow", "Pushkina", "Colotushkina"); bsu.DisplayDepartments(); bsu.AddDepartment(rpct); bsu.AddDepartment(rpctCopy); bsu.AddDepartment(management); bsu.AddDepartment(managementButDifferentType); bsu.DisplayDepartments(); }
private void DeptSaveButton_Click(object sender, EventArgs e) { department = new Department(); department.Code = codeTextBox.Text; department.Name = deptNameTextBox.Text; university.AddDepartment(department); MessageBox.Show("Department Added!"); codeTextBox.Text = ""; deptNameTextBox.Text = ""; }