advictoriam

Untitled

Jan 8th, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.44 KB | None | 0 0
  1. /**
  2.    A class to compare numbers.
  3. */
  4.  
  5. public class Numbers
  6. {
  7.    /**
  8.       Checks whether three numbers have all the same sign.
  9.       @return true if all of the numbers a, b, and c have the same sign
  10.    */
  11.    public boolean allSameSign(int a, int b, int c)
  12.    {
  13.       if(a < 0 && b < 0 && c < 0){return true;}
  14.       if(a > 0 && b > 0 && c > 0){return true;}
  15.       if(a == 0 && b == 0 && c == 0){return true;}
  16.       return false;
  17.    }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment