The first thing you need to know is what the program needs to do.
The next thing is what the inputs and outputs are.
One you've got that, if you don't have a good idea in your head about how to do it, the next step is research.
After that, take a look at what is already written. Maybe you...