static void Main(string[] args)
        {
            University CHNU = new University("The Bohdan Khmelnytsky National University of Cherkasy");

            CHNU.AddStudent(new Student("Serhii Yatsyn", 100));
            CHNU.AddStudent(new Student("Stas Lotskin", 89));
            CHNU.AddStudent(new Student("Euhen Korzh", 38));
            CHNU.AddStudent(new Student("Vlad Kravchenko", 43));
            CHNU.AddStudent(new Student("Alina Kosholap", 58));
            CHNU.AddStudent(new Student("Irina Mogila", 66));
            CHNU.AddStudent(new Student("Andrey Kharitonov", 1));
            CHNU.AddStudent(new Student("Anna Suscheva", 25));
            CHNU.AddStudent(new Student("Diana Ratsyna", 95));
            CHNU.AddStudent(new Student("Sasha Kotov", 99));

            CHNU.ShowAllStudents();

            Console.WriteLine("\n" + CHNU.Name + " average score is " + CHNU.getAverageScore());

            InternshipInCamp InCamp = new InternshipInCamp("Interlink");

            InCamp.StudentsValidation(CHNU);
            InCamp.GetStudents();
            Console.ReadLine();
        }
Beispiel #2
0
        public void TestUniversityAddStudent()
        {
            var massey  = new University();
            var student = new Student("12345678", "Big Mac", "01-07-1987", "33 Blah ave., Albany, North Shore");

            bool addSuccess;

            if (addSuccess = massey.AddStudent(student))
            {
                Console.WriteLine(student.Id + " added");
            }
            else
            {
                Console.WriteLine(student.Id + " existed");
            }

            if (addSuccess = massey.AddStudent(student))
            {
                Console.WriteLine(student.Id + " added");
            }
            else
            {
                Console.WriteLine(student.Id + " existed");
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            University university = new University(new StudentsService());

            university.AddStudent("Nadia", "Comanici");
            university.AddStudent("Vasile", "Popescu");
            university.AddStudent("Maria", "Ionescu");

            DisplayStudentById(university, 1);
            DisplayStudentById(university, 10);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            // Create new University
            University CHNU = new University("The Bohdan Khmelnytsky National University of Cherkasy");

            // Add students to University
            CHNU.AddStudent(new Student("Nikita Ivanov", 100));
            CHNU.AddStudent(new Student("Alina Tsymbal", 95));
            CHNU.AddStudent(new Student("Volodymyr Khandiuk", 85));
            CHNU.AddStudent(new Student("Stepan Karpov", 73));
            CHNU.AddStudent(new Student("Julia Veselkina", 58));
            CHNU.AddStudent(new Student("Stas Voidenko", 41));
            CHNU.AddStudent(new Student("Maria Perechrest", 25));
            CHNU.AddStudent(new Student("Serhii Yatsyn", 1));

            // Display the list of students
            CHNU.ShowAllStudents();
            // Display University average score
            Console.WriteLine("\nCHNU average score is {0}", CHNU.AverageScore());

            // Create new Intership
            InternshipInCamp InCamp = new InternshipInCamp("Interlink");

            // Check all students
            InCamp.StudentValidation(CHNU);
            // Display suitable students
            InCamp.GetStudents();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            university = new University(new StudentsService());
            university.AddStudent("Nadia", "Comanici", new DateTime(1986, 01, 24), Gender.Female);
            university.AddStudent("Radu", "Popescu", new DateTime(1990, 10, 13), Gender.Male);

            while (true)
            {
                DisplayMenu();

                Console.Write("Your option is: ");
                int option = 0;
                int.TryParse(Console.ReadLine(), out option);

                Console.WriteLine();

                switch (option)
                {
                case 1:
                    DisplayAllStudents();
                    break;

                case 2:
                    ReadStudent();
                    break;

                case 3:
                    SearchStudentById();
                    break;

                case 4:
                    DeleteStudentById();
                    break;

                case 5:
                    UpdateStudentById();
                    break;

                case 6:
                    return;

                default:
                    Console.WriteLine("Invalid option. Try again!");
                    break;
                }

                Console.WriteLine();
            }
        }
 static void Main(string[] args)
 {
     try
     {
         University university = new University(Logger.GetInstance());
         university.AddStudent("Nadia", "Comanici");
         university.AddStudent("Ion", "Popescu");
         university.DeleteStudentById(1);
         university.DeleteStudentById(10);
     }
     catch (Exception ex)
     {
         Logger.GetInstance().AddMessage(ex.Message);
     }
 }
Beispiel #7
0
        public void TestUniversityRemoveStudent()
        {
            var  massey     = new University();
            var  student    = new Student("12345678", "Big Mac", "12-12-1222", "33 Blah ave., Albany, North Shore");
            bool addSuccess = massey.AddStudent(student);

            bool removeSuccess;

            if (removeSuccess = massey.RemoveStudent("12345678"))
            {
                Console.WriteLine("12345678 removed");
            }
            else
            {
                Console.WriteLine("12345678 not existed");
            }

            if (removeSuccess = massey.RemoveStudent("12345678"))
            {
                Console.WriteLine("12345678 removed");
            }
            else
            {
                Console.WriteLine("12345678 not existed");
            }
        }
Beispiel #8
0
        private void StudentSaveButton_Click(object sender, EventArgs e)
        {
            student = new Student();

            student.RegNo          = Convert.ToInt32(regNoTextBox.Text);
            student.Name           = nameTextBox.Text;
            student.Email          = emailTextBox.Text;
            student.DepartmentCode = studentDeptComboBox.SelectedValue.ToString();
            MessageBox.Show("Student Added!");
            university.AddStudent(student);
        }
        static void Main(string[] args)
        {
            University university = new University(new StudentsService());

            university.AddStudent("Nadia", "Comanici");
            university.AddStudent("Vasile", "Popescu");
            university.AddStudent("Maria", "Ionescu");

            DisplayStudentById(university, 1);
            DisplayStudentById(university, 10);

            int x = 0;

            if (x > 0)
            {
                Console.WriteLine("Positive");
            }
            else
            {
                Console.WriteLine("Negative or zero");
            }
        }
Beispiel #10
0
        private void buttonConfirm_Click(object sender, EventArgs e)
        {
            if (textBoxName.Text == "" || textBoxId.Text == "" || textBoxBirthday.Text == "" || richTextBoxAddress.Text == "")
            {
                MessageBox.Show("Error: Please fill all the blanks.");
                return;
            }

            _student = new Student(textBoxId.Text, textBoxName.Text, textBoxBirthday.Text, richTextBoxAddress.Text);
            if (_university.AddStudent(_student))
            {
                MessageBox.Show("Added");
                this.Close();
            }
            else
            {
                MessageBox.Show("Existed, fail");
            }
        }
Beispiel #11
0
        private static Student ReadStudent()
        {
            Console.Write("Enter first name: ");
            string firstName = Console.ReadLine();

            Console.Write("Enter last name: ");
            string lastName = Console.ReadLine();

            Console.Write("Enter gender (m/f): ");
            string genderLetter = Console.ReadLine().ToLower().Trim();
            Gender gender       = Gender.Male;

            switch (genderLetter)
            {
            case "m":
                gender = Gender.Male;
                break;

            case "f":
                gender = Gender.Female;
                break;

            default:
                throw new ArgumentException("Invalid value for gender");
            }

            Console.Write("Enter year of birth (yyyy): ");
            int year = int.Parse(Console.ReadLine());

            Console.Write("Enter month of birth (1-12): ");
            int month = int.Parse(Console.ReadLine());

            Console.Write("Enter day of birth (1-31): ");
            int day = int.Parse(Console.ReadLine());

            return(university.AddStudent(firstName, lastName, new DateTime(year, month, day), gender));
        }