コード例 #1
0
        //Populating the total and average columns
        public void calculateTotalAndAverage(StudentDataForm sdf)
        {
            int    totalMock1 = 0;
            int    totalMock2 = 0;
            double valueAdded = 0;

            for (int i = 0; i < sdf.dgvStudentProgress.Rows.Count - 1; i++)
            {
                totalMock1 += int.Parse(dt.Rows[i][7].ToString());
                totalMock2 += int.Parse(dt.Rows[i][9].ToString());

                valueAdded += double.Parse(dt.Rows[i][11].ToString());
            }
            sdf.txtTotalM1.Text = totalMock1.ToString();
            sdf.txtTotalM2.Text = totalMock2.ToString();

            //averages from data input
            double average  = (totalMock1 / (sdf.dgvStudentProgress.Rows.Count - 1));
            double average2 = (totalMock2 / (sdf.dgvStudentProgress.Rows.Count - 1));

            sdf.txtAverageM1.Text = average.ToString();
            sdf.txtAverageM2.Text = average2.ToString();

            double avgVA = (valueAdded / (sdf.dgvStudentProgress.Rows.Count - 1));

            sdf.txtAverageVA.Text = avgVA.ToString();

            //Passing the average of the whole class through the algorithm
            DataAnalysis da            = new DataAnalysis();
            double       averageGrade  = da.progress8Mock1(Convert.ToInt32(average));
            double       averageGrade2 = da.progress8Mock2(Convert.ToInt32(average2));

            sdf.txtAvgGM1.Text = averageGrade.ToString();
            sdf.txtAvgGM2.Text = averageGrade2.ToString();
        }
コード例 #2
0
        //works out the grades by passing the progress 8 scores through DataAnalysis class (grade boundaries)
        public void gradeWorkout(StudentDataForm sdf)
        {
            //Adding the grade to the mock result from DatAnalysis
            DataAnalysis mock = new DataAnalysis();

            #region  progress 8 conversions -------------
            //new progress 8 measures conversions.
            for (int i = 0; i <= dt.Rows.Count - 1; i++)
            {
                //takes the value from the table and passes through mock 1 (2015 exam boundaries).
                double prog8 = mock.progress8Mock1(Convert.ToInt32(dt.Rows[i][7]));
                //takes the value from the table and passes through mock 2 (2016 exam boundaries).
                double prog82 = mock.progress8Mock2(Convert.ToInt32(dt.Rows[i][9]));
                //this adds the result into the datagrid.
                //I need to stop this from rounding
                sdf.dgvStudentProgress.Rows[i].Cells[8].Value  = prog8;
                sdf.dgvStudentProgress.Rows[i].Cells[10].Value = prog82;
                //Distance travelled displayed and worked out.
                double totalDist = mock.distanceTravelled(prog8, prog82);
                sdf.dgvStudentProgress.Rows[i].Cells[11].Value = (totalDist - (Convert.ToInt32(dt.Rows[i][6])));
            }
            #endregion
        }