In an experiment, an independent variable is the one that is controlled in order to measure the effects of the dependent variable. The dependent variable is the one that is being tested or measured.
In this example, the dependent variable would be the salary, as that is the one that is going to be affected. The independent variable is the gender, as that is the one that researchers can control.