Ask Question
18 January, 17:31

Write a method dominant that accepts three integers as parameters and returns true if any one of the three integers is larger than the sum of the other two integers. The integers might be passed in any order, so the largest value could be any of the three. If no value is larger than the sum of the other two, your method should return false. For example, the call of dominant (4, 9, 2) would return true because 9 is larger than 4 + 2. The call of dominant (5, 3, 7) would return false because none of those three numbers is larger than the sum of the others. You may assume that none of the numbers is negative.

+3
Answers (1)
  1. 18 January, 21:15
    0
    public class DominantCheck

    {

    public static Boolean dominant (int first, int second, int third)

    {

    if (first> (second+third))

    return true;

    else if (third> (first+second))

    return true;

    else

    return false

    }

    public static void main (String []args)

    {

    boolean ans=dominant (4,9,2);

    //Output display

    system. out. println (ans);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a method dominant that accepts three integers as parameters and returns true if any one of the three integers is larger than the sum ...” in 📙 Engineering if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers