Question: Write a static method named hasMidpoint that accepts three integers as parameters and returns true if one of the integers is the midpoint between the

 Write a static method named hasMidpoint that accepts three integers as

Write a static method named 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. The integers could be passed in any order; the midpoint could be the 1st, 2nd, or 3rd. You must check all cases. Calls such as the following should return true : hasMidpoint(4, 6, 8) hasMidpoint (2, 10, 6) hasMidpoint(8, 8, 8) hasMidpoint (25, 10, -5) Calls such as the following should return false : hasMidpoint(3, 1, 3) hasMidpoint(1, 3, 1) hasMidpoint (21, 9, 58) hasMidpoint (2, 8, 16)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!