The paint coverage formula
Start with the wall area, subtract openings, multiply by the number of coats, and divide by the coverage rate of the paint:
A standard interior door is about 21 sq ft and an average window about 15 sq ft; one gallon typically covers 350 sq ft in a single coat, though that varies by paint and surface.
Worked example
40 ft of wall, 8 ft high, 2 coats, minus 1 door and 2 windows:
Coats and coverage
Two coats is standard for an even finish, and more if you're going from a dark colour to a light one or painting bare drywall (which may need a primer coat first). Rough, porous or textured surfaces drink more paint, so they cover less than the rated 350 sq ft.