well im having quite alot of trouble doing questions like these could someone give me some insight into how they should be done thank you!

A function f(x) is known to be of the form F(x)=Acos(px+q) + B. It has a local maximum at (6, 8) and the next local minimum is at (10, 2). Find the constants A, p, q and B and hence give the formula for the function.