Yeah, you need to work out how your game loop is going to work, but asa others have said, this is the general principle.
Gravity accelerates objects at a constant rate. So you just stick that constant somewhere in your code, and assuming you're using Euler integration*, you just decrease the Y velocity by this amount per tick. To jump, you just set, on a particular tick, the Y velocity to some constant value, which is how hard you can jump.
* If you don't know, then you are probably using Euler integration. Look it up.