Development comes in four parts: Design, Code, Test, and Debug.
You've done the first three, and now it's time for the fun one: Debugging.
Why doesn't it work? I don't know, because you haven't told me how you know it doesn't - you haven't told me what you did in order to test it, or what results you got. And these are important: they tell you, the coder, what is wrong.
So start by looking at what you did: what did you enter, and what happened as a result. Any error messages are important. And output is important. How do the result relate to what you input and what you expected? When you've had a good think about about, it's time to bring out the debugger, and start working out why you get the results you do.
Put a breakpoint on the line
And run your app in the debugger.
When it hits the breakpoint, it will stop, and let you take over. You can step over lines, step into functions, and look at (or change) the content of variables. So look at each line, and work out exactly what should happen when it runs. Then execute the line, and look at what did happen. Is it what you expected? If so, continue for the next line. If not, why not? What did it do? Why didn't it do what you expected?
This is a skill - and a very valuable one in real life as well - but the only way to develop it is to use it: the more you use it the better you get! And it's a lot easier to learn and develop the skill on a little program like this, rather than a 100,000 line behemoth mostly written by a different developer!
So give it a try, and see what you can find out - it can be frustrating, but it's the real fun part of development when you find out what the problem is!