This thing took a toll on my sanity to make. Was it worth it? Hold down the mouse, and move to any point on the screen to apply a force to the ball. Press x to set the ball's position, and set the velocity to zero.
My brother helped me with the trigonometry for calculating how much of the ball was submerged for buoyancy, but the rest of the physics was just formulas I googled.