Write a method called hasMidpoint that accepts three integers as parameters and returns true if one of

Question:

Write a method called hasMidpoint that accepts three integers as parameters and returns true if one of the integers is the midpoint between the other two integers; that is, if one integer is exactly halfway between them. Your method should return false if no such midpoint relationship exists. For example, the call hasMidpoint(7, 4, 10) should return true because 7 is halfway between 4 and 10. By contrast, the call hasMidpoint(9, 15, 8) should return false because no integer is halfway between the other two. The integers could be passed in any order; the midpoint could be the 1st, 2nd, or 3rd. You must check all cases. If your method is passed three of the same value, return true.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: