This seems like a right angle triangle situation
the height is 3ft
the base is 4ft
so we're looking for the hypothenus
so we can use the Pythagoras Theorem
which is
the square of the hypothenus is equal to the sum of the square of the two other sides
hyp^2 is equal to opp^2+ adj^2
hyp^2 equals to 3^2 + 4^2
9+16
25
hyp^2 equals to 25

equals to 5
the ramp has to be 5ft long