When I am unsure how to get a program started, I try to answer the following questions in order:
1. What does the program need to output?
2. What data is needed to generate this output?
3. How can the output be calculated from the given data?
So, I start by writing the code for the output first. For any unknown values required in the output, I use variables.