Ejemplo n.º 1
0
        public static void AddElective(List <Elective> ElectiveData)
        {
            Console.WriteLine("Enter course code ");
            string code = Console.ReadLine();

            Console.WriteLine("Enter a description of course : ");
            string description = Console.ReadLine();

            Console.WriteLine("Enter the min number of places: ");
            int minNum = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Enter Max Number of places: ");
            int maxNum = Convert.ToInt32(Console.ReadLine());


            Elective el1 = new Elective(code, description, minNum, maxNum);

            ElectiveData.Add(el1);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.BackgroundColor = ConsoleColor.White;
            Console.Clear();
            Console.ForegroundColor = ConsoleColor.Black;
            List <Person>   StudentData  = new List <Person>();
            List <Elective> ElectiveData = new List <Elective>();
            Dictionary <string, HashSet <string> > StudentElectives = new Dictionary <string, HashSet <string> >();
            //Hardcoded Data!

            Elective el = new Elective("ID", "Internet Development", 1, 25);

            ElectiveData.Add(el);
            Elective el1 = new Elective("SD", "Software Development", 10, 25);

            ElectiveData.Add(el1);
            Elective el2 = new Elective("IS", "Internet Systems", 10, 45);

            ElectiveData.Add(el2);
            Elective el3 = new Elective("IT", "Information Technology", 15, 55);

            ElectiveData.Add(el3);
            Student st1 = new Student("Tom", "Williams", "150150", "08911111", "IT", "IS", "2018");

            StudentData.Add(st1);
            Student st2 = new Student("Andy", "Mallow", "150151", "08711111", "IT", "ID", "2018");

            StudentData.Add(st2);
            Student st3 = new Student("Sarah", "Hardy", "150152", "08611111", "SD", "ID", "2018");

            StudentData.Add(st3);

            // --End of hardcoded data

            int option = 0;

            do
            {
                MenuHeader();
                option = Convert.ToInt32(Console.ReadLine());
                Console.Clear();
                ManagerData(StudentData, ElectiveData, ref StudentElectives);
                switch (option)
                {          //MENU OPTION
                case 1:    //ADD STUDENT OPTION
                    AddStudent(StudentData, ElectiveData);
                    break;

                case 2:     //DISPLAY STUDENT OPTION
                    DisplayStudents(StudentData);
                    break;

                case 3:     // DISPLAY K-NUMBERS BY ELECTIVE CHOICE
                    KElectives(StudentData, ElectiveData, ref StudentElectives);
                    break;

                case 4:     //UPDATE ELECTIVE DETAILS FOR STUDENT
                    UpdateElective(StudentData);
                    break;

                case 5:     //ADD ELECTIVE
                    AddElective(ElectiveData);
                    break;

                case 6:     //MANAGEMENT MENU
                    KElectivesChoice2(StudentData, ElectiveData, ref StudentElectives);
                    break;

                case 7:     //EXIT
                    break;

                default:
                {
                    Console.WriteLine("Option not implemented");
                    break;
                }
                }
            } while (option != 7);
        }