Do you know the rule?
We write «a» before a consonant sound, and «an» if the next sound is a vowel.
Notice that it is the sound, not necessarily the spelling, that is important. A word such as «universe» or «university» looks as if it begins with a vowel, but the «u» is pronounced ju, therefore: a university.
Remember that the letter «y» is not a vowel in English, so we say and write a young person.
In heir, heiress, honest, honour, honourable and hour the «h» at the beginning of the word is silent, so the words start off with a vowel: an honour, an heir, an honest person, an hour.
apple, banana, pear, orange, house, horse, hour, answer, honest answer, idea, useless idea, Englishman, European country,