Beispiel #1
0
        internal static void YourMethodYevhenii(Student[] data)
        {
            TupleList <string, double> NameWithAvarageMark = new TupleList <string, double>();

            Task(data, ref NameWithAvarageMark);
            Console.WriteLine("\nStudents who have an avarage mark of more than 4.5:");
            for (int i = 0; i < NameWithAvarageMark.Count; i++)
            {
                Console.WriteLine(NameWithAvarageMark[i].Item1 + " " + NameWithAvarageMark[i].Item2);
            }
            Console.WriteLine();
        }
Beispiel #2
0
        /*TODO:
         * 1) Find scholarship average
         * 2) Print student inisials that has scholarship value < average - 20 %
         * (include only those students which have scholarship and exectly less than average - 20 % from average)
         */
        internal static void ShowStudWithSmallScholarship(Student[] data)
        {
            TupleList <string, int> studInfo = new TupleList <string, int>();
            double average = GetAverage(data, ref studInfo);
            double bound   = (average * 20) / 100;

            Console.WriteLine("\nStudents that have 20% less money from scholarship average:");
            for (int i = 0; i < studInfo.Count; i++)
            {
                if (average - bound > studInfo[i].Item2)
                {
                    Console.WriteLine(studInfo[i].Item1);
                }
            }
            Console.WriteLine();
        }
Beispiel #3
0
        static void Task(Student[] data, ref TupleList <string, double> NameWithAvarageMark)
        {
            string FullName = "";

            foreach (var Student in data)
            {
                int inf  = (int)Char.GetNumericValue(Student.informaticsMark);
                int math = (int)Char.GetNumericValue(Student.mathematicsMark);
                int phys = (int)Char.GetNumericValue(Student.physicsMark);
                int sum  = inf + math + phys;
                if ((double)sum / 3 > 4.5)
                {
                    FullName = Student.surName + " " + Student.firstName + " " + Student.patronymic;
                    NameWithAvarageMark.Add(FullName, (double)sum / 3);
                }
            }
        }
Beispiel #4
0
        static double GetAverage(Student[] data, ref TupleList <string, int> studInfo)
        {
            double average = 0.0;

            int    count = 0;
            string fullName;

            foreach (var stud in data)
            {
                if (stud.scholarship > 123 & stud.scholarship < 2345)
                {
                    fullName = stud.surName + " " + stud.firstName + " " + stud.patronymic;
                    studInfo.Add(fullName, stud.scholarship);
                    average += stud.scholarship;
                    ++count;
                }
            }
            return(count > 0 ? average /= count : 1);
        }