If a ship is sailing with a constant speed of 30 m/s to the east and a cannonball is launched straight up into the air from the deck of the ship, why does the cannonball land back in the cannon and not in the ocean behind?

The forward motion of the cannonball is the same as the forward motion of the ship; while the cannonball is in the air, the ship keeps moving to keep up with it, and the ball returns to its original position.

Look at it another way. You are on a ship. The ship is moving at a fast clip of 5 mph. You draw a line on the deck. Now you jump toward the front of the ship by 3 feet. Where do you land?(ans: 3 feet in front of the line.) Now you jump 3 feet to the rear of the ship. Where do you land? *ans: 3 feet back of the line.) Remember you are traveling at 5 mph while the ship is traveling 5 mph.