static void Main(string[] args) { int C; bool T = true; Course C1 = new Course(); C = C1.GetCourseInfo(); Console.WriteLine(); Student[] arraylistofStudents = new Student[C]; while (T == true) { for (int i = 0; i < C; i++) { arraylistofStudents[i] = new Student(); Console.Write("Student Name:"); arraylistofStudents[i].SName = Console.ReadLine(); Console.Write("Student Number:"); arraylistofStudents[i].SNumber = int.Parse(Console.ReadLine()); Console.WriteLine(); } System.Console.Write(" Would you like to start again enter true or false? "); T = bool.Parse(Console.ReadLine()); Console.WriteLine(); } Console.WriteLine("+-----------------------------------------------+"); C1.PrintCourseInfo(); Console.WriteLine("+-----------------------------------------------+"); Console.WriteLine(); for (int i = 0; i < C; i++) { Console.WriteLine("+-----------------------------------------------+"); Console.Write("Student Name: " + arraylistofStudents[i].SName + ", "); Console.WriteLine("Student Number: " + arraylistofStudents[i].SNumber); Console.WriteLine("+-----------------------------------------------+"); } Console.Write("Press Enter to finish..."); Console.ReadKey(); }
static void Main(string[] args) { string getIn = "y"; while (getIn == "y" || getIn == "Y") { System.Console.Clear(); Questions.printHeader(); Course course = new Course(); course.AskName(); course.AskCRN(); int numStudents = Questions.AskForInteger("How many students do you want: "); course.SetStudents(numStudents); course.PrintCourse(); System.Console.WriteLine(); getIn = Questions.AskForString("Do you want to start over (y/n)").ToLower(); } System.Console.WriteLine("Press a key to continue..."); System.Console.ReadKey(); }
static void Main(string[] args) { Student s1 = new Student(), s2 = new Student(), s3 = new Student(); Teacher t1 = new Teacher(); Course ProgrammingWithCSharp = new Course("Programming with C#"); ProgrammingWithCSharp.AddStudent(s1); ProgrammingWithCSharp.AddStudent(s2); ProgrammingWithCSharp.AddStudent(s3); ProgrammingWithCSharp.AddTeacher(t1); Degree Bachelor = new Degree("Bachelor"); Bachelor.AddCourse(ProgrammingWithCSharp); UProgram InformationTechnology = new UProgram("Information Technology"); InformationTechnology.AddDegree(Bachelor); Console.WriteLine("The " + InformationTechnology.name + " program contains the " + InformationTechnology.degree.name + " of Sciense degree\n"); Console.WriteLine("The " + InformationTechnology.degree.name + " of Sciense degree contains the course " + InformationTechnology.degree.course.name + "\n"); Console.WriteLine("The " + InformationTechnology.degree.course.name + " course contains " + Student.TrackStudent.student_num + " student<s>"); Console.ReadLine(); }
public void AddCourse(Course c) { course = c; }