Solved

Programming
Write a Static Method Named HasMidpoint That Accepts Three

Question 4

Essay

Programming
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)\begin{array}{c}\begin{array}{}\text{Calls such as the following should return true:}\\ \text{hasmidpoint (4,6,8)}\\\text{ hasmidpoint (2,10,6)}\\\text{ hasmidpoint (8,8,8)}\\\text{ hasmidpoint (25,10,-5)}\end{array}\begin{array}{}\text{Calls such as the following should return false :}\\ \text{hasmidpoint (3,1,3)}\\\text{ hasmidpoint (1,3,1)}\\\text{ hasmidpoint (21,9,58)}\\\text{ hasmidpoint (2,8,16)}\end{array}\end{array}

Correct Answer:

verifed

Verified

(five solutions shown)
public static boo...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents