The implementation of anything consists in formalizing the task, writing requirements, writing an algorithm according to these requirements, and translating the algorithm into PL.
In short, specify the question, what exactly you do not know how to do.