Quantum calculus on finite intervals and applications to impulsive difference equations