The following method attempts to return the median (middle) of three integer values, but it contains logic errors. In what cases does the method return an incorrect result? How can the code be fixed? public static int medianof3 (int n1, int n2, int n3) { if (nl < n2) { if (n2 < n3) { return n2; } else {
Chapter 4, Self Check Problems #27
The following method attempts to return the median (middle) of three integer values, but it contains logic errors. In what cases does the method return an incorrect result? How can the code be fixed?
This problem has been solved!
Do you need an answer to a question different from the above? Ask your question!
Related Book For
Building Java Programs A Back To Basics Approach
5th Edition
Authors: Stuart Reges, Marty Stepp
ISBN: 9780135471944