The perimeter of a given triangle, whose sides are in the ratio of $3 : 4 : 5$, is greater by $\quantity{4}{ft.}$ than that of a given square. The area of the square is greater by $\quantity{25}{sq.ft.}$ than that of the triangle. Find the lengths of the sides of the square and of the triangle.