I hope this is right this is just how I do it :)
-Write out the scale of the tonic key (key that your'e in)
-Its easiest to modulate to the dominant key. To find the dominant key go to soh (5th note of the tonic scale). For example the dominant key of C major is G major.
-Write out the scale of the new key. The accidental is the extra sharp/flat/natural that is in the dominant key but not in the tonic key. For example the accidental of the key of G would be F# because F is natural in the key of C. The accidental is always on ti (7th note) of the dominant scale.
-In minor melodies don't modulate to the dominant key instead go to the relative major
Ya actually can someone please tell me what to do in bars 7 and 8 if it's in a minor key and what do you mean by relative key? Do you just do an imperfect cadence and do you put any sharps or flats or anything like that?? Help!!