Cocaine and Amphetamines are both considered narcotics. All three of these drugs are stimulants, yet narcotic is commonly used to refer to "any of the substances, natural or synthetic, in Schedules I and II of the Single Convention on Narcotic Drugs, 1961, and that Convention as amended by the 1972 Protocol Amending the Single Convention on Narcotic Drugs, 1961"
Since caffeine is completely legal and uncontrolled, it is not considered a narcotic.
Correction...The term medical "narcotic" generally refers to a sleep-inducing drug and, nowadays, to opiate/opiod medications.
In common slang parlance, the term "narcotic" may be incorrectly used as a synonym for "illegal drug", but this usage is not accurate.
As such, none of the aforedescribed drugs are scientifically narcotics.