>>12716168Maybe the diagram approach is messing things up for you. Try expressing the DFA as a table. So, if you have to design, let's say - a DFA for a language that contains all integers that can be divided by 7, with the alphabet of all decimal numbers {0, 1, 2, ... , 9}. First acknowledge the underlying rule for checking, if the word belongs to the language - in this case you MOD 7 from each letter, whilst adding the result to the next letter. So, you make a table expressing all necessary states in a column (from where the result of MOD is 0 up until where the result is 6) and all possible letters (0-9) in a row. After that just fill in all of the possible results and leave the result = 0 state as the accepting state.
So, the things to keep in mind are to firstly find the underlying rule for how to check if a word is valid, then constructing the DFA in a table. There isn't an algorithm for doing this - it just requires problem solving skills.