what is the difference between a capacitor and a resistor?