Class timetable generation program in C#

As a “fun” project for school, I am attempting to create a timetable generation program which will automatically assign students and teachers to lessons and those lessons to one of 5 periods within a day, with a maximum value for how many periods can have a lesson assigned to them. It will then calculate the timetable for each person and assign them a timetable based off of the main lesson timetable. In my school, each class of students has two lessons for each subject with a different teacher, and there may be multiple sets of classes depending on the number of students.

The data is all housed in a School class, which does all the initial sorting after being constructed. The constructor takes an array of teachers, students, lessons offered by the school and a preferred class size (there will likely be more variables added as more constraints are added). The list of teachers is provided in a format where each teacher has a name and an array of subjects they can teach. The list of students is provided in a similar format, but instead of the array of subjects they can teach, they have an array of subjects they want to learn.

To sort the data initially after the School has been constructed, the subjects offered by the school are looped through and on each loop the teachers or students are looped through, checking whether they can teach/want to learn the said subject. If they can/do, they are added to the subject’s teacher/student lists, and for each teacher teaching the subject a new lesson is created for them to teach.

To log all this data, I loop through each subject and their teacher/student lists, printing each person to the console. I then loop through the lessons for each subject and print those too.

So, I have all the teachers and students sorted, now what do I do next? I know I need to somehow assign each student to a lesson with a teacher and make sure they don’t clash or anything, but I’m finding the whole task a little daunting and haven’t a clue how to tackle this next bit.

Thanks for any help or advice, you can rest assured you’ll have made this 16-year old’s headache a little more manageable.

My C# console project can be found at