Here is the basic physics you need to make what you're working on:
v = a*t
d = v*t
where 'v' is Velocity, 'a' is Acceleration, 'd' is Distance and 't' is time.
We'll be using a 't' value of 1 itineration, so we won't need to worry about it.
This means every frame you want to add your 'acceleration' value to 'velocity' and your 'velocity' to 'distance'. This you've figured out on your own, it seems. For efficiency, however, you should put your a value as a variable so you don't have to look through your code to find it.
There is a constant downwards acceleration called 'gravity'. This means every object should, at all times, be accelerating downwards at your gravity constant, no matter where it is or whatever other forces are acting on it.
Now, whenever you have one object hitting another or hitting a wall you have what's called a 'collision'. You have 'elastic collisions', where the objects bounce away and 'inelastic collisions', where the objects don't bounce. There's no such thing as a 100% elastic collision; every time two objects collide some of the momentum is lost.
Every pairing of objects should have an elasticity constant between 0 and 1, 0 being totally inelastic and 1 being totally elastic. Then, you multiply the current velocity by the negative of the elasticity value.
eg. if Elast = 0.3 you would do:
if (collision) v *= -0.3;
Every time it bounces, the velocity is reduced.
In total, your code should be as follows:
CONSTANTS:
gravity, elast
VARIABLES
vX, vY, x, y
EVERY FRAME
vY+= gravity;
x+=vX; y+=vY;
if (ball collides with ground) vY*= (0-elast)
if (ball collides with wall) vX*= (0-elast)
And that's it!