What determines a batters slugging percentage?

Slugging percentage is computed by dividing a player’s total bases by number of at-bats. A player who goes 2-4 with a double and a single would have 3 total bases in 4 at-bats, for a slugging percentage of .750.