示例#1
0
文件: MainApp.cs 项目: zvrabec/mono
		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;
				}
			}

		}
示例#2
0
 //singleton pattern za listu
 public static StudentContainer Instance()
 {
     if (instance == null)
     {
         instance = new StudentContainer();
     }
     return(instance);
 }
示例#3
0
 public static StudentContainer getInstance()
 {
     if (studentContainer == null)
     {
         studentContainer = new StudentContainer();
         return(studentContainer);
     }
     return(studentContainer);
 }
示例#4
0
        //static Student student = new Student();

        public static void EnlistStudent()
        {
            var student = new Student();

            Console.WriteLine("------------->  ENLIST  <-------------");
            FirstName(student);
            LastName(student);
            GPA(student);
            StudentContainer.AddStudent(student);
        }
示例#5
0
 public StudentService()
 {
     storage = StudentContainer.Instance;
 }