I believe that you are supposed to add the strength modifier or dexterity modifier depending on if it is a melee weapon or if it is a ranged weapon respectively. Then add the proficiency bonus if they are proficient in the weapon. All of this is added to the roll of a d20. Am I correct?
Your proficiency bonus is applied if you have proficiency with the weapon. This is generally determined by your class. Other factors may grant you proficiency with other weapons (e.g. High Elves have proficiency with longsword, shortsword, shortbow and longbow in addition to whatever weapons their class grants).
Strength vs Dexterity
In general, melee weapons use Strength and ranged weapons use Dexterity. Of course, there are exceptions (see Weapon Properties on PH p. 146-7.).
If the melee weapon is marked finesse, then you may use Dexterity or Strength (e.g. Rapier).
If the ranged weapon is marked thrown and may also be employed as a melee weapon, then you employ Strength rather than Dexterity (e.g. Spear).
If a ranged weapon is marked thrown, may be employed as a melee weapon, and is marked finesse, then you may employ Strength or Dexterity (e.g. Dagger).
You are correct - melee weapons use strength (even if thrown), ranged weapons use dexterity. On slight complication is that weapons with the Finesse characteristic use strength or dexterity at the users choice (usually whichever is better). If the person is proficient with the weapon they also add their proficiency bonus.