예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            string[]    item         = comboBox1.SelectedItem.ToString().Split(' ');
            StudentStat tempStudStat = students.First(p => p.Surname.Equals(item[1]));

            name.Text    = tempStudStat.Name;
            surname.Text = tempStudStat.Surname;
            id.Text      = tempStudStat.Id;
            techGPA.Text = tempStudStat.TechGPA.ToString();
            humGPA.Text  = tempStudStat.HumGPA.ToString();

            int TechProcent = (int)dp.TechLearningResults(students, tempStudStat.Id);
            int HumProcent  = (int)dp.HumLearningResults(students, tempStudStat.Id);

            label7.Text    = TechProcent + "% of Students in Technical Subjects and " + HumProcent + "% of students in Humanitarian Subjects!";
            label6.Visible = true;
            label7.Visible = true;

            string toTech = "Technical Subjects Average GPA - " + tempStudStat.TechGPA;
            string toHum  = "Humanitarian Subjects Average GPA - " + tempStudStat.HumGPA;

            chart2.Series[0].Points.Clear();
            chart2.Series[0].Points.AddXY(toTech, tempStudStat.TechGPA);
            chart2.Series[0].Points.AddXY(toHum, tempStudStat.HumGPA);

            chart1.Series[0].Points.Clear();
            for (int i = 0; i < tempStudStat.SemesterGPA.Count; i++)
            {
                chart1.Series[0].Points.AddXY((i + 1), tempStudStat.SemesterGPA[i]);
            }
            chart1.Refresh();
        }
예제 #2
0
        /// <summary>
        /// Taking data to the specified list
        /// </summary>
        /// <param name="path"></param>
        /// <returns>List of Students info</returns>
        public List <StudentStat> TakeData(string path)
        {
            List <StudentStat> output = new List <StudentStat>();

            if (File.Exists(path))
            {
                foreach (string line in File.ReadLines(path))
                {
                    string[]    info;
                    StudentStat tempStud = new StudentStat();
                    info                = line.Split(' ');
                    info[6]             = info[6].Remove(info[6].Length - 2);
                    info[7]             = info[7].Remove(info[7].Length - 2);
                    tempStud.Surname    = info[0];
                    tempStud.Name       = info[1];
                    tempStud.FamilyName = info[2];
                    tempStud.Id         = info[3];
                    tempStud.Speciality = info[4];
                    tempStud.Course     = int.Parse(info[5]);
                    tempStud.TechGPA    = double.Parse(info[6]);
                    tempStud.HumGPA     = double.Parse(info[7]);
                    int i = 8;
                    tempStud.SemesterGPA = new List <double>();
                    while (i < info.Length - 1)
                    {
                        tempStud.SemesterGPA.Add(double.Parse(info[i]));
                        i++;
                    }
                    output.Add(tempStud);
                    techStat += tempStud.TechGPA;
                    humStat  += tempStud.HumGPA;
                }
            }
            techStat = techStat / output.Count;
            humStat  = humStat / output.Count;

            return(output);
        }