示例#1
0
        private void AllAssignmentAverage(Classlist classlist)
        {
            var assignments = classlist.students[0].GetAllAssignments().ToArray();

            Console.WriteLine();
            foreach (Assignment assignment in assignments)
            {
                float average = Classlist.GetClassAverageByAssignmentName(classlist.students, assignment.Name);
                Console.WriteLine($"{assignment.Name} {average:F}");
            }
        }
示例#2
0
        private void SpecificAssignmentAverage(Classlist classlist)
        {
            Console.Write("\nEnter assignment name: ");
            string assignment = Console.ReadLine().Trim();

            float average = Classlist.GetClassAverageByAssignmentName(classlist.students, assignment);

            if (average >= 0)
            {
                Console.WriteLine($"\nClass average for assignment {assignment} is {average:F}");
            }
            else
            {
                Console.WriteLine($"{assignment} does not exist\n");
            }
        }