static void Main() { #region object definition Person student = new Student(); student.SetInformationFromInput(); student.PrintDetails(); Person teacher = new Teacher(); teacher.SetInformationFromInput(); teacher.PrintDetails(); UProgram uProgram = new UProgram(); uProgram.SetInformationFromInput(); uProgram.PrintDetails(); Course course = new Course(); course.SetInformationFromInput(); course.PrintDetails(); #endregion #region call method with NotImplementedException DateTime birthDate; string birthDateString = "12/01/1900"; // mm/dd/yyyy student.ValidatePersonBirthdate(birthDateString, out birthDate); #endregion }
static void Main() { #region Instantiating 3 Student objects var student1 = new Student { FirstName = "Billy", LastName = "Jackson", BirthDate = new DateTime(1990, 12, 12), AddressLine1 = "5th Avenue", AddressLine2 = String.Empty, City = "Dodge City", StateProvince = "Kansas", ZipPostal = "67801", Country = "U.S.A." }; var student2 = new Student { FirstName = "Eric", LastName = "Kruger", BirthDate = new DateTime(1992, 4, 16), AddressLine1 = "Mastodon Avenue, Seattle, Washington", AddressLine2 = String.Empty, City = "Seattle", StateProvince = "Washington", ZipPostal = "98113", Country = "U.S.A." }; var student3 = new Student { FirstName = "Jeremy", LastName = "Pokluda", BirthDate = new DateTime(1991, 1, 24), AddressLine1 = "Jamestown Boulevard, Jackson, Minnesota", AddressLine2 = String.Empty, City = "Jackson", StateProvince = "Minnesota", ZipPostal = "55003", Country = "U.S.A." }; #endregion #region Instantiating a Course object var csCourse = new Course { Name = "Programming with C#", Credits = 20, DurationInWeeks = 4 }; #endregion #region Adding 3 Students to the Course object csCourse.AddStudent(student1); csCourse.AddStudent(student2); csCourse.AddStudent(student3); #endregion #region Instantiating a Teacher object var teacher = new Teacher { FirstName = "Jimmy", LastName = "Johnes", BirthDate = new DateTime(1970, 1, 7), AddressLine1 = "38th Street, Montgomery, Alabama", AddressLine2 = String.Empty, City = "Montgomery", StateProvince = "Alabama", ZipPostal = "36109", Country = "U.S.A." }; #endregion #region Adding the Teacher object to the Course object csCourse.AddTeacher(teacher); #endregion #region Instantiating a Degree object var bachelorsDegree = new Degree { Name = "Bachelor of Science", CreditsRequired = 120 }; #endregion #region Adding the Course object to the Degree object bachelorsDegree.AddCourse(csCourse); #endregion #region Instantiating a UProgram object called Information Technology var uProgram = new UProgram { Name = "Information Technology", DepartmentHead = "Leland Stanford" }; #endregion #region Adding the Degree object to the UProgram object uProgram.AddDegree(bachelorsDegree); #endregion #region Output string uProgramOutputFormatString = "The {0} contains the {1} degree"; string degreeOutputFormatString = "The {0} degree contains the course {1}"; string courseOutputFormatString = "The {0} contains {1} student{2}"; foreach (var degree in uProgram.Degrees) { Console.WriteLine(uProgramOutputFormatString, uProgram.Name, degree.Name); Console.WriteLine(); foreach (var course in degree.Courses) { Console.WriteLine(degreeOutputFormatString, degree.Name, course.Name); Console.WriteLine(); int studentCount = course.Students.Count; Console.WriteLine(courseOutputFormatString, course.Name, studentCount, (studentCount > 1) ? "s" : String.Empty); Console.WriteLine(); } } #endregion }