Възникна грешка при обработването на вашата заявка. Извиняваме се за неудобството. Моля, опитайте по-късно.
Loading...
+ Нов въпрос
kiril_kirilov avatar kiril_kirilov 3 Точки

10. *SoftUni Course Planning от Exercise: Lists

Условието: https://softuni.bg/downloads/svn/soft-tech/Sept-2020/CSharp/05. CSharp-Fundamentals-Lists/05. CSharp-Fundamentals-Lists-Exercise.docx

 

Моето решение: https://pastebin.com/uEDj39MA

 

След много проверки, корекции и т.н. получавам 88/100 /един грешен тест/.

Помощ при откраване на грешката?

Предварително благодаря!

 

Тагове:
0
C# Fundamentals
Axiomatik avatar Axiomatik 802 Точки

Had the same problem with my solution, Test #8 error is triggered by the 'Exercise' operation which requires to check whether a given course AND it's exercise exist or not or just one of the two.

Exercise-operation (88%):

        static List<string> ExerciseOperator(string title, List<string> courseSchedule)
        {
            bool courseExist = courseSchedule.Exists(course => course == title);
            int courseIndex = courseSchedule.FindIndex(course => course == title);
            int exerciseIndex = courseIndex + 1;
            if (courseExist)
            {
                courseSchedule.Insert(exerciseIndex, title + "-Exercise");
            }
            else if (courseExist == false)
            {
                courseSchedule.Add(title);
                courseSchedule.Add(title + "-Exercise");
            }
            return courseSchedule;
        }

Exercise-operation (100%):

        static List<string> ExerciseOperator(string title, List<string> courseSchedule)
        {
            bool courseExist = courseSchedule.Exists(course => course == title);
            bool exerciseExist = courseSchedule.Exists(course => course == title + "-Exercise");
            int courseIndex = courseSchedule.FindIndex(course => course == title);
            int exerciseIndex = courseIndex + 1;
            if (courseExist && exerciseExist == false)
            {
                courseSchedule.Insert(exerciseIndex, title + "-Exercise");
            }
            else if (courseExist == false)
            {
                courseSchedule.Add(title);
                courseSchedule.Add(title + "-Exercise");
            }
            return courseSchedule;
        }

Best,

 

 

 

1