Question: The picture is the prompt the code below must be used to complete the prompt. import java.util.Scanner; public class TensDigit { public static void main(String[]
The picture is the prompt the code below must be used to complete the prompt.
import java.util.Scanner;
public class TensDigit {
public static void main(String[] args) { // Do not edit this method Scanner keyboard = new Scanner(System.in); int first = keyboard.nextInt(); int second = keyboard.nextInt(); System.out.println(tensDigitsEqual(first, second)); keyboard.close(); }
public static boolean tensDigitsEqual(int x, int y) { // This is where your code goes } }
22.5 Tens Digit Given two non-negative integers x and y, write a method that returns true if their tens-place digits are the same. Otherwise, the method should return false. (In case you've forgotten place-value notation, consider this example: for the integer 42, 2 is in the ones place, 4 is in the tens place, 0 is in the thousands place, O is in the ten-thousands place, and so on.) hint: Any digit of an integer can be extracted using the division (l) and modulo (%) operators. Each operator only needs to be used once
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
