Ask Question
29 June, 17:11

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.

+2
Answers (1)
  1. 29 June, 20:21
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers