Beispiel #1
0
		public static void Main (string[] args)
		{
			string action;
			StudentContainer sl = new StudentContainer ();
			action = Operations.validateAction ();
			while(action == "ENLIST" || action=="DISPLAY") {
				switch(action){
				case "ENLIST":

					Student st = new Student () {
						firstName = Operations.validateNames ("First"),
						lastName = Operations.validateNames ("Last"),
						GPA = Operations.validateGPA ()
					};
					sl.AddStudent (st);
					action = Operations.validateAction ();
					break;
				case "DISPLAY":
					if (sl.Count == 0) {
						Console.WriteLine ("There are no students to display!");
					} else {
						sl.Sort("lastname");
						foreach (Student s in sl) {
							s.PrintDetails ();
						}
					}
					action = Operations.validateAction ();
					break;
				}
			}

		}
 public static void AddStudentData(string firstName, string lastName, float gpa)
 {
     Student s = new Student();
     s.FirstName = firstName;
     s.LastName = lastName;
     s.Gpa = gpa;
     s.Id = IdGenerator.Instance.GetNextID();
     studentList.Add(s);
 }