static void Main(string[] args)
        {
            var path   = @"C:\Users\DJTom\Downloads\students-marks_v03.csv";
            var school = new SchoolReport();

            school.GradeReport(path);
        }
Beispiel #2
0
        public void TotalGrading(string[] columnArray1, string[] names, string[] columnArray2, string[] schoolSubjects, int[] columnArray3)
        {
            SchoolReport tempReport  = new SchoolReport();
            var          grade       = 0.0;
            var          nameTemp    = 0;
            var          subjectTemp = 0;
            var          temporary   = 0;
            var          divisor     = 0;
            var          gradeAvg    = 0.0;
            var          evaluation  = "";

            while (nameTemp < names.Length)
            {
                if (columnArray1[temporary] == names[nameTemp] && columnArray2[temporary] == schoolSubjects[subjectTemp])
                {
                    divisor++;
                    grade += columnArray3[temporary];
                }


                if (temporary == columnArray3.Length - 1)
                {
                    grade = Math.Round((grade / divisor));
                    if (grade == 5)
                    {
                        evaluation = "Neprospěl";
                    }
                    if (grade == 3 && evaluation != "Neprospěl")
                    {
                        evaluation = "Prospěl";
                    }

                    var verbalGrade = tempReport.verbalGrading(grade);

                    Console.WriteLine($"{names[nameTemp]} - {schoolSubjects[subjectTemp]}: {verbalGrade}");
                    gradeAvg += grade;
                    temporary = 0;
                    grade     = 0;
                    divisor   = 0;
                    subjectTemp++;
                }

                if (subjectTemp == schoolSubjects.Length)
                {
                    gradeAvg = Math.Round(gradeAvg / 6, 2);
                    if (gradeAvg <= 1.5 && evaluation != "Neprospěl" && evaluation != "Prospěl")
                    {
                        evaluation = "Prospěl s vyznamenáním";
                    }
                    Console.WriteLine($"{names[nameTemp]} - Celkový průměr: {gradeAvg} ({evaluation})");
                    Console.WriteLine();
                    nameTemp++;
                    gradeAvg    = 0;
                    subjectTemp = 0;
                    evaluation  = null;
                }
                temporary++;
            }
        }
Beispiel #3
0
        public void GradeReport(string path)
        {
            SchoolReport school = new SchoolReport();

            // Rozdělení sloupců
            var column1 = school.ColumnSplitter(0, path);
            var column2 = school.ColumnSplitter(1, path);
            var column4 = school.ColumnSplitter(3, path);

            // Smazání duplicitních jmen a předmětů, přidělení správné velikosti arrayům
            string[] names          = school.Unduplicator(column1);
            string[] schoolSubjects = school.Unduplicator(column2);

            // Konverze listů na arraye
            string[] columnArray1 = column1.ToArray();
            string[] columnArray2 = column2.ToArray();
            int[]    columnArray3 = school.ToIntArray(column4.ToArray());

            // Finální oznámkování a výpis známek
            school.TotalGrading(columnArray1, names, columnArray2, schoolSubjects, columnArray3);

            Console.ReadKey();
        }