Question: Write a method called snakeEyes which takes three integers as parameters (representing three die rolls of 1-6) and returns true if exactly two of them
Write a method called snakeEyes which takes three integers as parameters (representing three die rolls of 1-6) and returns true if exactly two of them are 1s (we sometimes call this "snake eyes"). If all three numbers are 1s or there are not at least two 1s, the method should return false.
The table below shows sample calls and the value that should be returned.
Method Call Value Returned ------------------------------------- snakeEyes(1,2,3) false snakeEyes(1,1,1) false snakeEyes(1,2,1) true snakeEyes(1,1,4) true snakeEyes(5,1,1) true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
