Ejemplo n.º 1
0
        //Counts the number of students per elective
        public static int CountStudent(Electives e, List <Student> students)
        {
            int amount = 0;

            foreach (Student s in students)
            {
                if (s.electives.Contains(e))
                {
                    amount++;
                }
            }
            return(amount);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            List <Student>   students  = new List <Student>();   //This stores a list of Students and their data
            List <Electives> electives = new List <Electives>(); //This stores a list of Electives and their data

            int option = 0;

            do
            {
                Console.WriteLine();
                Console.WriteLine("********Elective Application*******");
                Console.WriteLine();
                Console.WriteLine("1.   Add Students");
                Console.WriteLine("2.   Display Students");
                Console.WriteLine("3.   Display KNumbers");
                Console.WriteLine("4.   Change Elective Details");
                Console.WriteLine("5.   Add an Elective");
                Console.WriteLine("6.   Management Information");
                Console.WriteLine("7.   Exit");

                Console.WriteLine("Please choose an option from the menu:");
                option = Convert.ToInt32(Console.ReadLine());

                Console.Write("You Chose Option: ");
                Console.WriteLine(option);

                switch (option)
                {
                case 1:
                    //Working
                    AddData(students, electives);

                    break;

                case 2:
                    //Working
                    DisplayStudents(students);

                    break;

                case 3:
                    // Display a list of Knums by elective
                    DisplayKnum(students, electives);
                    break;

                case 4:
                    // enter a knum and change elective details
                    SearchKnum(students, electives);
                    //countStudent(students, electives);
                    break;

                case 5:
                    #region case 5
                    // add an elective to the system

                    Console.WriteLine("New Elective Code:");
                    string ElectiveCode = Convert.ToString(Console.ReadLine());

                    Console.WriteLine("New Elective Name:");
                    string ElectiveName = Convert.ToString(Console.ReadLine());

                    Console.WriteLine("New Elective Maximum:");
                    int ElectiveMax = Convert.ToInt32((Console.ReadLine()));

                    Console.WriteLine("New Elective Minimum:");
                    int ElectiveMin = Convert.ToInt32((Console.ReadLine()));

                    Electives newElective = new Electives(ElectiveCode, ElectiveName, ElectiveMax, ElectiveMin);
                    electives.Add(newElective);
                    #endregion

                    break;

                case 6:
                    //Calls the Submenu
                    Submenu(electives, students);
                    break;

                default:
                    break;
                }
            } while (option != 7);
        }