First, draw a diagram of the situation to visualize the problem:
Notice that the triangle ASB is a right triangle because the angle ASB has a measure of 90º. The segment SP is perpendicular to AB, then the triangles BSP and ASP are also right triangles.
Notice that:
On the other hand:
Isolate SA and replace AB=18 and ABS=54º:
From the first equation, isolate x and replace the value of SA and the measure of the angle SAP=36º:
Use a calculator to find the value of x:
Therefore, to the nearest tenth of a mile, the distance from the ship to the shore is 8.6 miles.