static void Main(string[] args) { var students = new[] { new Student { FirstName = "Petr" }, new Student { FirstName = "Ivan" }, new Student { FirstName = "Igor" } }; var course = new Course { Name = "Programming with C#", Students = students }; var teacher = new Teacher { FirstName = "Nikiphor" }; course.Teachers[0] = teacher; var degree = new Degree { Name = "Bachelor", Course = course }; var program = new UProgram { Name = "Information Technology", Degree = degree }; Console.WriteLine("The {0} program contains the {1} of Science degree", program.Name, program.Degree.Name); Console.WriteLine("The {0} of Science degree contains the course {1}", degree.Name, degree.Course.Name); Console.WriteLine("The {0} course contains {1} students", course.Name, course.Students.Length); Console.WriteLine("Press any key to continue"); Console.ReadKey(); }
static void Main(string[] args) { Student stu1 = new Student("Firstname1", "lastname1", "01-01-0001", "adress1", "adress21", "city1", "state1", 1, "country1"); Student stu2 = new Student("Firstname2", "lastname2", "02-02-0002", "adress2", "adress22", "city2", "state2", 2, "country2"); Student stu3 = new Student("Firstname3", "lastname3", "03-03-0003", "adress3", "adress23", "city3", "state3", 3, "country3"); Course csharp = new Course("Programming with C#", 4, 6); csharp.addStudent(stu1); csharp.addStudent(stu2); csharp.addStudent(stu3); Teacher teach = new Teacher("Teacher1", "Teacherlastname", "01-01-0001", "teachadress", "teachadress2", "teachcity", "teachstate", 55, "teacountry"); csharp.addTeacher(teach); Degree bachelor = new Degree("Bachelor", 8); bachelor.Course = csharp; UProgram IT = new UProgram("Information Technology", "dptHead"); IT.Degree = bachelor; // Displaying infos Console.WriteLine("Program : {0}, Degree : {1}", IT.Name, IT.Degree.Name); Console.WriteLine("Course in the degree : {0}", bachelor.Course.CourseName); Console.WriteLine("Number of students in course : {0}", Student.StudentsCount); }
static void Main(string[] args) { //Console.WriteLine("Student Count: {0}.\n",Student.TotalCount); var student1 = new Student("Joe", "Smith", new DateTime(1985, 4, 13)); //Console.WriteLine("Student Count: {0}.\n", Student.TotalCount); var student2 = new Student("John", "Doe", new DateTime(1984, 1, 31)); //Console.WriteLine("Student Count: {0}.\n", Student.TotalCount); var student3 = new Student("Jane", "Doe", new DateTime(1988, 9, 22)); //Console.WriteLine("Student Count: {0}.\n", Student.TotalCount); // new Student[] {...} could be just new []{...} // but I figured it's good to be explicit for the purpose of the course var students = new Student[] { student1, student2, student3 }; var teacher = new Teacher("\"Uncle\" Bob", "Martin", new DateTime(1948, 10, 8)); var cleanCode = new Course("Clean Code 101", "McConnell", "42A", new[] { teacher }, students); var compSci = new Degree("Computer Science", DegreeType.Bachelor); compSci.Courses.Add(cleanCode); var program = new UProgram("Information Technology", 30.5m); program.Degrees.Add(compSci); WriteProgramInfo(program); }
public static void Main(string[] args) { Student student1 = new Student("Richard", "VanSickle", new DateTime(1986, 3, 10), "169 Saxony Rd", "#212", "Encinitas", "CA", "92024", "USA"); Student student2 = new Student("Bob", "Smith", new DateTime(1975, 5, 11), "123 Main St", "", "Pleasantville", "CA", "92123", "USA"); Student student3 = new Student("Mary", "Jones", new DateTime(1991, 7, 22), "17 South St", "#246", "San Diego", "CA", "90007", "USA"); Course course1 = new Course("Programming with C#", 5, 12); Teacher teacher1 = new Teacher("Professor", "Longhair"); Degree degree1 = new Degree("Bachelor of Science", 132); UProgram uProgram1 = new UProgram("Computer Science", "Sandy Beach"); course1.students[0] = student1; course1.students[1] = student2; course1.students[2] = student3; course1.teachers[0] = teacher1; degree1.course = course1; uProgram1.degree = degree1; Console.WriteLine($"The {uProgram1.ProgramName} program contains the {uProgram1.degree.DegreeType} degree"); Console.WriteLine($"The {uProgram1.degree.DegreeType} degree contains the course {uProgram1.degree.course.CourseName}"); Console.WriteLine($"The {uProgram1.degree.course.CourseName} course contains {Student.studentCount}"); Console.ReadLine(); }
static void Main(string[] args) { //Instantiate three Student objects. Student[] stArr = new Student[3]; stArr[0] = new Student("Sophie", "Greene", new DateTime(1982, 12, 1), "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK"); stArr[1] = new Student("Mandy", "Newton", new DateTime(1985, 11, 12), "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK"); stArr[2] = new Student("Sonia", "Cry", new DateTime(1952, 1, 12), "30 Some Street", "", "Leeds", "West Yorkshire", "ZE7 3AE", "UK"); //Instantiate a Course object called Programming with C#. Course[] courses = new Course[1]; courses[0] = new Course("Programming with C#", 3, 16); //Add your three students to this Course object. courses[0].Students = stArr; //Instantiate at least one Teacher object. Teacher[] tchArr = new Teacher[2]; tchArr[0] = new Teacher("Manual", "Zu", new DateTime(1970, 1, 1), "30 Other Street", "", "Sheffield", "West Yorkshire", "LE7 9MN", "UK"); tchArr[1] = new Teacher("Handy", "Man", new DateTime(1930, 10, 1), "30 Other Street", "", "Sheffield", "West Yorkshire", "LE7 9MN", "UK"); //Add that Teacher object to your Course object courses[0].Teacher = tchArr; //Instantiate a Degree object, such as Bachelor. Degree[] deg = new Degree[1]; deg[0] = new Degree("Bachelor Of Science", 84); // Add your Course object to the Degree object. deg[0].Courses = courses; //Instantiate a UProgram object called Information Technology. UProgram prog = new UProgram("Information Technology", "Some One"); //Add the Degree object to the UProgram object. prog.Degrees = deg; /*Using Console.WriteLine statements, output the following information to the console window: * The name of the program and the degree it contains * The name of the course in the degree * The count of the number of students in the course.*/ Console.WriteLine("The {0} program contains the {1}", prog.ProgramName, prog.Degrees[0].Name); Console.WriteLine(); Console.WriteLine("The {0} degree contains the course {1}", prog.Degrees[0].Name, prog.Degrees[0].Courses[0].Name); Console.WriteLine(); Console.WriteLine("The {0} course contains {1} student(s) ", prog.Degrees[0].Courses[0].Name, Student.studentCnt); Console.WriteLine(); #region keep console window open Console.Write("Press Any Key to Continue"); Console.ReadKey(); Console.Clear(); #endregion }
private static void Main() { // Instantiate three Student objects. var harry = new Student("Harry", "Potter", new DateTime(1980, 7, 31)); var ron = new Student("Ron", "Weasley", new DateTime(1980, 3, 1)); var hermione = new Student("Hermione", "Granger", new DateTime(1979, 9, 19)); // Instantiate a Course object called Programming with C#. var course = new Course("Programming with C#") { // Add your three students to this Course object. Students = new Collection <Student> { harry, ron, hermione }, // Add that Teacher object to your Course object. Teachers = new Collection <Teacher> { new Teacher("Remus", "Lupin", new DateTime(1960, 3, 10)) } }; // Instantiate a Degree object, such as Bachelor. var degree = new Degree("Bachelor") { // Add your Course object to the Degree object. Course = course }; // Instantiate a UProgram object called Information Technology. var uProgram = new UProgram("Information Technology") { // Add the Degree object to the UProgram object. Degree = degree }; try { // Using Console.WriteLine statements, output the following information to the console window: Console.WriteLine(uProgram + Environment.NewLine); Console.WriteLine(degree + Environment.NewLine); Console.WriteLine(course.ToString()); // Uncomment the following line to print the current enrolled count // Console.WriteLine(Student.EnrolledCount); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { Console.WriteLine("Press any key to continue ..."); Console.ReadLine(); } }
private static void WriteProgramInfo(UProgram program) { var degree = program.Degrees.First(); Console.WriteLine("The {0} program contains the {1} degree.\n", program.Name, degree); var course = degree.Courses.First(); Console.WriteLine("The {0} degree contains the course {1}.\n", degree, course); Console.WriteLine("The {0} course has {1} student(s).\n", course, course.Students.Length); }
static void Main(string[] args) { // 1. Instantiate three Student objects. Student student1 = new Student("Santiago", "Mendoza", "Manga", 21); Student student2 = new Student("Ruben", "Melo", "Torices", 23); Student student3 = new Student("Cesar", "De la Hoz", "Cartagena", 24); // 2. Instantiate a Course object called Programming with C#. Course course_c_sharp = new Course("Programming with C#", 4); Student[] students = new Student[3]; students[0] = student1; students[1] = student2; students[2] = student3; // 3. Add your three students to this Course object. course_c_sharp.Students = students; // 4. Instantiate at least one Teacher object. Teacher teacher = new Teacher("Jairo", "Serrano", "Ternera", 30); Teacher[] teachers = new Teacher[1]; // 5. Add that Teacher object to your Course object course_c_sharp.Teachers = teachers; // 6. Instantiate a Degree object, such as Bachelor. Degree degree = new Degree("Bachelor of Science"); // 7. Add your Course object to the Degree object. degree.Course = course_c_sharp; // 8. Instantiate a UProgram object called Information Technology. UProgram program = new UProgram("Information Technology", "Universidad Tecnológica de Bolívar"); // 9. Add the Degree object to the UProgram object. program.Degree = degree; /* 10. sing Console.WriteLine statements, output the following information to the console window: * The name of the program and the degree it contains * The name of the course in the degree * The count of the number of students in the course. * Your output should look similar to this: */ Console.WriteLine("The {0} program contains the {1} degree", program.Name, program.Degree.Name); Console.WriteLine("The {0} degree contains the course {1}", program.Degree.Name, program.Degree.Course.Name); Console.WriteLine("The {0} course contains {1} students", program.Degree.Course.Name, Student.Total_students); Console.ReadKey(); }
static void Main(string[] args) { Student student1 = new Student("Ivan", "Ivanov", "Sofia", 1000, "Bulgaria"); Student student2 = new Student("Petar", "Petrov", "Sofia", 1000, "Bulgaria"); Student student3 = new Student("Todor", "Todorov", "Sofia", 1000, "Bulgaria"); Student[] students = { student1, student2, student3 }; Teacher teacher1 = new Teacher("Radomir", "Radomirov", "Sofia", 1000, "Bulgaria"); Teacher[] teachers = { teacher1 }; Course course = new Course("Programming with C#", students, teachers); Degree degree1 = new Degree("Bachelor", course, 120); UProgram programe = new UProgram("Information Technology", degree1); Console.WriteLine($"The {programe.ProgramName} program contains the {degree1.DegreeName} of Science degree"); Console.WriteLine(); Console.WriteLine($"The {programe.Degree} of Science degree contains the course {course.CourseName}"); Console.WriteLine(); Console.WriteLine($"The {course.CourseName} course contains {Student.studentCounter} student<s>"); }
static void Main(string[] args) { Student s1 = new Student("Angel", "Munoz", new DateTime(1992, 05, 16), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico"); Student s2 = new Student("Perla", "Lopez", new DateTime(1992, 12, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico", "Dir2"); Student s3 = new Student("Victor", "Munoz", new DateTime(1992, 07, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico"); Student[] students = { s1, s2, s3 }; Teacher t1 = new Teacher("Dora", "Rivero", new DateTime(1980, 05, 16), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico"); Teacher t2 = new Teacher("Ricardo", "Trejo", new DateTime(1981, 03, 19), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico", "Dir2"); Teacher t3 = new Teacher("Victor", "Arellanes", new DateTime(1980, 05, 10), "Dir1", "Juarez", "Chihuahua", 12345, "Mexico"); Teacher[] teachers = { t1, t2, t3 }; Course PCS = new Course("Programming with C#", 15, 6, teachers, students); Course PFS = new Course("Programming with F#", 12, 7, teachers, students); Course PJ = new Course("Programming with Java", 15, 5, teachers, students); Course[] courses = { PCS, PFS, PJ }; Degree bachelor = new Degree("Bachelor", 500, courses); UProgram uprogram = new UProgram("Information Technology", "Mike Perez", bachelor); Console.WriteLine("Program: {0}\nDegree: {1}", uprogram.PName, uprogram.Degree.Name); Console.WriteLine("Course:{0}\nStudents in Course: {1}", uprogram.Degree.Courses[0].CName, Student.StudentAmt); Console.ReadKey(); }
static void Main(string[] args) { Student student1 = new Student("Wang", "Gang", "April 23, 1983"); Student student2 = new Student("Tony", "Stark", "January 03, 1994"); Student student3 = new Student("Steve", "Rogers", "July 04, 1920"); Teacher teacher = new Teacher("Bill", "Gates", "April 05, 1960"); Course course = new Course("Programming with C#"); course.addteacher(teacher, 0); for (int i = 0; i < 3; i++) { switch (i) { case 0: course.addstudent(student1, i); break; case 1: course.addstudent(student2, i); break; case 2: course.addstudent(student3, i); break; } } Degree degree = new Degree(course, "Bachelor of Science Degree"); UProgram uprogram = new UProgram(degree, "Information Technology"); Console.WriteLine("The {0} program contains the {1}", uprogram.name, ((Degree)uprogram.degree).name); Console.WriteLine("The {0} contains the course {1}", degree.name, degree.course.courseName); Console.WriteLine("The {0} course contains {1} student<s>", course.courseName, course.studentList.Length); }
public static void Main(string[] args) { //Instatiating 3 student objects Student s1 = new Student("John", "Doe", "20/Feb/1992", "BB suites", "123 Main Street", "New York", "New York", "USA", "123 NY"); Student s2 = new Student("Musoke", "Joseph", "14/Feb/1990", "Makerere University", "P.O Box 7062 Kampala, Uganda", "Kampala", "Wakiso", "Uganda", "7062 KLA"); Student s3 = new Student("John", "Doe", "20/Feb/1991", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA"); //Instatiating Course object Course c1 = new Course("Programming With CSharp"); //Adding students to Course Object c1.addStudent(s1); c1.addStudent(s2); c1.addStudent(s3); //Instatianting teacher object Teacher t1 = new Teacher("Sarah", "Becks", "20/Apr/1970", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA"); Teacher t2 = new Teacher("Joseph", "Zuck", "20/Jun/1950", "BD suites", "123 Main Street", "Los Angeles", "Los Angeles", "LA", "123 LA"); //adding teachers to Course Object c1.addTeacher(t1); c1.addTeacher(t2); //instatitiating degree object and adding Course Object to degree Degree d = new Degree("Bachelor", 400, c1); //Instatiating UProgram object UProgram p = new UProgram(); p.setProgramName("Information Technology"); p.addDegree(d); // Console.WriteLine("{0} Program contains {1} degree", p.getProgramName(), p.getDegreeName(d)); Console.WriteLine("{0} degree contains the {1} course", d.getDegreeName(), d.getCourseName(c1)); Console.WriteLine("The {0} Course containes {1} student(s)", c1.getCourseName(), c1.countStudents()); }