i have two problems that i need help with. i always have trouble setting up the equations. help is appreciated!

jane is 2 miles offshore in a boat and wishes to reach a coastal village 6 miles down a straight shoreline from the point nearest the boat. she can row 2 miles per hour and can walk 5 miles per hour. where would she land her boat to reach the village in the least amount if time?

a rectangle is to be inscribed under the arch of the curve y = 4cosx(0.5x) from x=-pi to x=pi. what are the dimensions of the rectangle with the largest area and what is the largest area?