Numbers that read the same forwards and backwards (e.g., 34743) are known as palindromic numbers. In other words, a numb
Posted: Sat Nov 27, 2021 2:43 pm
Numbers that read the same forwards and backwards (e.g., 34743) are known as palindromic numbers. In other words, a number is palindromic if it is equal to its reversal. Number Reverse Number o Write a method that 12345 0 has the header public static int reverse(int number), 12345/10 → 1234 10 * 0 + 12345 % 10 → 5 computes the reverse of a given integer (number) as its input parameter 1234 / 10 → 123 10 * 5 + 1234 % 10 → 54 and returns the reversed number. 123 / 10 → 12 10 * 54 + 123 % 10 → 543 Hint: You can use the approach shown in the example on the right. 12/10 → 1 10 * 543 +12 % 10 → 5432 Write another method that 1/100 10 * 5432 + 1 % 10 → 54321 has the header public static boolean is Palindrome (int number), returns true if a given integer (number) as its input parameter is palindromic and returns false otherwise by using the reverse method for getting the reverse of the number to compare with the number itself. Write a program that reads a positive integer from the user, uses the isPalindrome method to check whether the user-entered integer is palindromic or not and prints the result on the console as shown in the example console inputs and outputs below. Example Console Inputs and Outputs: Enter a positive integer: 12345 Enter a positive integer: 12321 Enter a positive integer: 3 12345 is NOT palindromic. 12321 is palindromic. 3 is palindromic.