Menu

Java Write Method Named Hasshareddigit Two Parameters Type Int Number Within Range 10 Incl Q43824479

Java

Write a method named hasSharedDigit with two parameters of typeint.  

Each number should be within the range of 10 (inclusive) – 99(inclusive). If one of the numbers is not within the range, themethod should return false.

The method should return true if there is a digit that appearsin both numbers, such as 2 in 12 and 23; otherwise, the methodshould return false.

EXAMPLE INPUT/OUTPUT:

* hasSharedDigit(12, 23); → should return true since the digit 2appears in both numbers

* hasSharedDigit(9, 99); → should return false since 9 is notwithin the range of 10-99

* hasSharedDigit(15, 55); → should return true since the digit 5appears in both numbers

NOTE: The method hasSharedDigit should be defined as public staticlike we have been doing so far in the course.

Expert Answer


Answer to Java Write a method named hasSharedDigit with two parameters of type int. Each number should be within the range of 10 (…

OR