.
Answer. The rate of the cruise ship for the first  40 mi  is  10 miles per hour.
Check.   
 = 4 + 4 = 8 hours.     ! Correct !
Solution
Let "r" be the slower rate of the cruise ship, in miles per hour.
Then the faster speed is (r+5) miles per hour.
The time spent to cover 40 miles at the rate "r" mph is 
 hours.
The time spent to cover 60 miles at the rate (r+5) mph is 
 hours.
The condition says that the total time is 8 hours:
 + 
 = 8.
To solve this equation, multiply both sides by r*(r+5). You will get
40*(r+5) + 60*r = 8r*(r+5).
Simplify and solve for "r".
40r + 200 + 60r = 8r^2 + 40r,
8r^2 - 60r - 200 = 0,   ====>  (divide both sides by 4)  ====>
2r^2 - 15r - 50 = 0,
 = 
 = 
.
Only positive root r= 10 works.
Answer. The rate of the cruise ship for the first  40 mi  is  10 miles per hour.
Solved.
-------------
-------------
I edited my post.
I apologize for my words in previous version.