private void AddStudentButton_Click(object sender, RoutedEventArgs e)
        {
            ListBoxItem studentListBoxItem = new ListBoxItem();

            studentListBoxItem.Content = LastNameTextBox.Text + " " + FirstNameTextBox.Text;
            StudentsListBox.Items.Add(studentListBoxItem);
            if (LevelBox.Text == "Undergraduate")
            {
                UndergraduateStudent tempStudent = new UndergraduateStudent();
                tempStudent.Age       = Convert.ToInt32(AgeTextBox.Text);
                tempStudent.FirstName = FirstNameTextBox.Text;
                tempStudent.LastName  = LastNameTextBox.Text;
                tempStudent.Gender    = GenderBox.SelectedIndex;
                tempStudent.StudentID = Convert.ToInt32(StudentIDTextBox.Text);
                students.Add(tempStudent);
            }
            else
            {
                GraduateStudent tempStudent = new GraduateStudent();
                tempStudent.Age       = Convert.ToInt32(AgeTextBox.Text);
                tempStudent.FirstName = FirstNameTextBox.Text;
                tempStudent.LastName  = LastNameTextBox.Text;
                tempStudent.Gender    = GenderBox.SelectedIndex;
                tempStudent.StudentID = Convert.ToInt32(StudentIDTextBox.Text);
                students.Add(tempStudent);
            }
            StudentsListBox.SelectedItem = StudentsListBox.Items.GetItemAt(StudentsListBox.Items.Count - 1);
        }
        private void AddStudentButton_Click(object sender, RoutedEventArgs e)
        {
            UndergraduateStudent test = new UndergraduateStudent();

            try //test if in correct format if not cancel action by return
            {
                test.Confirm(FirstNameTextBox.Text, LastNameTextBox.Text, Convert.ToInt32(StudentIDTextBox.Text), comboBox.Text, levelBox.Text, Convert.ToInt32(AgeTextBox.Text));
            }
            catch (OverflowException)
            {
                MessageBox.Show("ID or age to large please try again");
                return;
            }
            catch (FormatException)
            {
                MessageBox.Show("   Input was not in proper format\n" + "\t- All fields are required");
                return;
            }
            //if no exception fill usuable variables
            string fName    = FirstNameTextBox.Text;
            string lName    = LastNameTextBox.Text;
            int    id       = Convert.ToInt32(StudentIDTextBox.Text);
            string gender   = comboBox.Text;
            string level    = levelBox.Text;
            int    age      = Convert.ToInt32(AgeTextBox.Text);
            string nameTest = lName + fName;
            string name     = fName + " " + lName;

            try
            {
                while (storage != null)
                {
                    for (int counter = 0; counter < storage.Length; counter++)
                    {
                        string checkName = storage[counter].LastName + storage[counter].FirstName;
                        int    checkID   = storage[counter].ID;
                        if (!test.StudentCheck(nameTest, checkName, id, checkID))
                        {
                            MessageBox.Show(nameTest + "\n" + checkName + "\n" + Convert.ToString(id) + "\n" + Convert.ToString(checkID));
                            return;
                        }
                    }
                    continue;
                }
            }
            catch (NullReferenceException)
            {
                //do nothing, storage array is empty and nothing to compare it to
            }
            if (levelBox.Text == test.Check)    //if student will be undergraduate then make one and put into array for later use
            {
                UndergraduateStudent student = new UndergraduateStudent(fName, lName, gender, age, id, level);
                storage[i] = student;
                MessageBox.Show(name + " Added to storage " + "\n");
            }
            else    //else must be grad student, create one, put into storage
            {
                GraduateStudent gStudent = new GraduateStudent(fName, lName, gender, age, id, level);
                storage[i] = gStudent;
                MessageBox.Show(name + " Added to storage " + "\n");
            }

            //populate list box with relevant info
            ListBoxItem studentListBoxItem = new ListBoxItem();

            studentListBoxItem.Content = storage[i].LastName + " " + storage[i].FirstName + "\n" + storage[i].ID + "\n" + storage[i].Gender + " " + storage[i].Age + "\n" + storage[i].lvl;
            StudentsListBox.Items.Add(studentListBoxItem);

            //clear text boxes for ease of use and bump i for next use
            FirstNameTextBox.Text  = null;
            LastNameTextBox.Text   = null;
            StudentIDTextBox.Text  = null;
            AgeTextBox.Text        = null;
            comboBox.SelectedIndex = 0;
            levelBox.SelectedIndex = 0;

            i++;
        }
        private void AddCourseButton_Click(object sender, RoutedEventArgs e)
        {
            UndergraduateStudent test = new UndergraduateStudent();
            Course      courseTest    = new Course();
            ListBoxItem selected      = new ListBoxItem();

            string[] content = null;
            string   stuff   = null;

            selected.Content = StudentsListBox.SelectedItem;
            stuff            = Convert.ToString(selected.Content);
            content          = stuff.Split();
            string level;

            try
            {
                int idTest = Convert.ToInt32(content[3]);
            }
            catch (IndexOutOfRangeException)
            {
                MessageBox.Show("Please Select a Student");
                return;
            }
            int id = Convert.ToInt32(content[3]);

            if (selected.Content != null)
            {
                try
                {
                    if (!courseTest.Check(CourseNameTextBox.Text, Convert.ToInt32(CourseNumberTextBox.Text), Convert.ToInt32(CreditHoursTextBox.Text), Convert.ToDouble(GPATextBox.Text), level = content[6]))
                    {
                        return;
                    }
                }
                catch (FormatException)
                {
                    MessageBox.Show("Input in improper format");
                    return;
                }
            }
            else
            {
                MessageBox.Show("Please select a student");
                return;
            }

            string name      = content[2] + " " + content[1];
            string cName     = CourseNameTextBox.Text;
            int    cNumber   = Convert.ToInt32(CourseNumberTextBox.Text);
            int    credHours = Convert.ToInt32(CreditHoursTextBox.Text);
            double gpa       = Convert.ToDouble(GPATextBox.Text);

            Course course = new Course(cName, cNumber, credHours, gpa, name, id);

            courseStorage[j] = course;
            MessageBox.Show("Course Added to " + name + "'s Courses" + "\n");

            if (true)
            {
                j++;
                CourseNumberTextBox.Text = null;//clear text boxes for next entry
                CourseNameTextBox.Text   = null;
                GPATextBox.Text          = null;
                CreditHoursTextBox.Text  = null;
                return;
            }//always true will trigger if reach this point, cleanup method while debugging code
        }