Z
Z
ZavkHozz7772020-05-31 23:54:18
Java
ZavkHozz777, 2020-05-31 23:54:18

Is there a class to fill with temporary tasks?

Hello!
I was engaged in the development of a program that is a kind of schedule for the day of a teacher with a database. It is planned to create a Day entity and fill it with objects of the Lesson class, which contain the start time and duration (Lessons can be of different lengths). The question is about the implementation of the Day class, namely, how to place a Lesson in it so that there are no lesson-to-lesson overlays, while everyone can have free time between lessons.

Thanks to everyone who replies...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-06-01
@ZavkHozz777

It's not clear what your problem is. If the goal is simply to avoid overlaps, then check in the method for adding a lesson per day that the beginning of one lesson is not less than the end of another. If you need to fill as many study hours as possible in one day without overlap, then a greedy scheduling algorithm will do. If there are dependencies between lessons, then topological sorting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question