What I always say to my students is that the case is not determined by the ending, but by the context and sentence where it is used. In your case, genetive can be used with so called possessive meaning, sth belongs to the famer. Filia agricolae pulchra est. The famer's daughter is beautiful. Dative is used as indirect object in the sentence with some of the "giving verbs" where in english are used the prepositions to or for. Rosam puellae do. I am giving a rose to the girl. Rosam puellae emo. I am buying a rose for the girl. Nominative is always used as the subject of the sentence or as the nominal part of the predict with the verb to be. Puellae in schola sunt. The girls are at school. And the vocative is used when talking to somebody direvtly, there is always a coma after it and the verb must be in the 2nd person sg or pl or imperative.
Puellae, cenam paratis. Girls, you are preparing dinner.
Puellae, cenam parete! Girls, prepare dinner!