Even longer answer than Ingmar’s long one:
In German noun phrases (aka. nominal groups etc.), all parts have to agree in gender, number and case. In nominative (R:S:E = m:n:f) and accusative (N:S:E), one of the attributes or the noun itself has to be inflected to show the gender of the phrase. The gender is determined by the nominal lexeme’s linguistic gender (Genus), which is often determined by a derivational suffix, or by the natural gender (Sexus) of its signified. Plural substitutes gender except in personal pronouns.
The noun, i.e. the head of the nominal phrase, can only be inflected by gender if it is a pronoun, an adjective or a participle; although some proper nouns (e.g. Paul, Paula) and common nouns (Freund, Freundin; Helfer, Helferin; Zauberer, Zauberin; Zeuge, Zeugin; Arzt, Ärztin; Witwe, Witwer) arguably inflect by gender, too, though m:f only.
Pronouns of all kinds are rarely accompanied by attributes and when they are, they’re treated like common nouns (incl. uppercase initial and inflection: des wahren Ichs). Most other heads never stand alone, but proper nouns (i.e. names), mass nouns (like Wasser), abstract nouns (Liebe) and plurals may. In predicative use others may as well.
Most of those nominal words that can stand alone may also take attributes without an article. Some article-like attributes are only possible with plural heads.
If an article is present it is always the leftmost attribute or, to put it differently: the leftmost attribute may be an article (since there’s more than d+ and ein+). Possessives (i.e. either pronouns or genitive forms) work the same. Articles and possessives are mutually exclusive – one could also say they belong to a common category. Other attributes follow them and the head noun marks the end of the phrase at the right. The exception are appositions.
Definite articles (das/-er/-ie, dieses/-er/-e etc.) are always strongly inflected by gender. Indefinite articles (ein+, kein+) and possessive pronouns etc. (mein+, dein+, sein+, ihr+) are always weakly inflected by gender, except when used as predicates of course. Cardinal numbers work mostly like indefinite articles, but are always plural, hence no gender.
Adjectives can inflect in three ways (usually termed weak, mixed and strong) and they are also used uninflected as predicates.
Attributive adjectives always inflect opposite to the article if any.
That means strongly inflected adjectives follow non-inflected attributes and complex inflected attributes (i.e. personal pronouns) or stand alone.
Attributes of the same kind inside the same phrase have to be inflected the same, but “same kind” is sometimes ambiguous, because the leftmost attribute can often be considered either an article or an adjective.
Das kalte Wasser im See gefriert fast. Die kalten Wasser des Pazifik bewirken El Niño. – weak inflection
Ein kaltes Wasser hätte ich gern. Zwei kalte Wasser, bitte! – mixed inflection
Kaltes Wasser gefällt mir nicht. Kalte Wasser stürzen den Berg hinunter. – strong inflection
Kaltwasser kommt aus dem rechten Hahn. – no inflection
all nominative neuter
Hund (like the composite Schäferhund) is not a mass noun like Wasser:
Der Deutsche Schäferhund, die Deutschen Schäferhunde … – weak
Ein Deutscher Schäferhund, zwei Deutsche Schäferhunde … – mixed
Deutsche Schäferhunde … strong
all nominative masculine, last one only possible in plural
By the way, a female German shepherd is either a Schäferhündin or rather a Schäferhundhündin, a male one is always a Schäferhundrüde.
German attributive (article + adjective) inflection, masculine:neuter:feminine
Case Definite/Demonstrative Indefinite/Possessive Isolated Predicative
Nom | r:s:e + e -:-:e + r:s:e r:s:e r:s:e
Acc | n:s:e + n:e:e n:-:e + n:s:e n:s:e r:s:e
Dat | m + n m + n m:m:r m
Gen | s + n s + n n:n:r s
- Definite articles and demonstrative pronouns d+, dies+, jen+, d+jenige(n), d+selbe(n), welch+, jed[wed]+, all+ are used with “weakly” inflected adjectives.
- Indefinite articles [irgend]ein+, kein+ and possessive pronouns mein+/dein+/sein+/ihr+/uns+/eur+ are used with “mixed” inflected adjectives.
- Uninflected pronouns or particles der[lei|gleichen], welch, manch, wessen, dessen, deren and mass/plural articles einig+, etlich+, etwelch+ are used with “strongly” inflected adjectives, but there are exceptions. Isolated adjectives also inflect strongly.
- manch+, einig+ (Sg), mehrere, irgendwelch+ fluctuate.