This ball goes through the rectangle rather than hitting it or bouncing it

@yanze03, I also did the other side you ballx and bally but it is still not bouncing on it Here are my codes:

float ballx,bally,xspeed=5,yspeed=8;

void setup() {
size(displayWidth,displayHeight);
stroke(255);
strokeWeight(100);
}

void draw() {
background(0);
point(ballx,bally); //draw the ball
if(sideCollision(ballx)) {
xspeed = xspeed * -1; //reverse horizontal speed
}
if(topOrBottomCollision(bally)) {
yspeed = yspeed*-1; //reverse vertical speed
}
ballx = ballx + xspeed;
bally = bally + yspeed;
rect(810,100,300,75);
rect(mouseX,880,300,75);
if( ballx > 810 || ballx < 1110){
xspeed = xspeed*-1;
}
if( bally > 810 || bally < 1110){
xspeed = xspeed*-1;
}
}

boolean sideCollision(float x) {
if(x<0 || x>width) {
return true;
} else {
return false;
}
}

boolean topOrBottomCollision(float y) {
if(y<0 || y>height) {
return true;
} else {
return false;
}
}

Please Help as Soon as Possible