I stick the tune, in abc format (or from a MIDI if it is just the melody), into my program HARMONY and it does the rest for me. That's the reason I wrote it in the first place.
And it will play you the result, to check.
Get it from my site to try for free