Hello, nathan02079!
In your "distance formula", you're squarerooting when you should square.
2. From a lighthouse, the range of visibility on a clear day is 40 km.
On a coordinate system, where O(0,0) represents the lighthouse,
a ship is travelling on a course represented by: .
Between which two points on the course can the ship be seen from the lighthouse? Code:

 *
 *
Q * 
o 
* * 
P * * 
o * 
* * * 
* *
           *    
O
and have coordinates such that: .
We want: .
So we have: .
Factor: .
Then: .
The ship can be seen from to