Q3. Create two methods: one that will reverse the order of the digits in an integer and a second determines if a number is a palindrome (i.e. reads the same front to back) using the following method...


Q3.<br>Create two methods: one that will reverse the order of the digits in an integer and<br>a second determines if a number is a palindrome (i.e. reads the same front to back) using<br>the following method headers.<br>// Method 1: Takes in an integer and reverses it, e.g., reverse(456) returns 654<br>public static int reverse(int number)<br>// Method 2: Takes in an integer and returns true if it is a palindrome. Use the reverse<br>method you just wrote to implement this method.<br>public static boolean isPalindrome(int number)<br>Create a test program that asks the user to input an integer and provides feedback on<br>whether the integer is a palindrome or not.<br>Hint: To find the reverse number, use one of the following approaches:<br>• Modify your numerical inputs to a string, then use a for loop to reverse the characters<br>with string concatenation and the charAt() method.<br>Retrieve individual digits and combine them in reverse order using the / and % operators,<br>using ten as a divisor. Combine the digits with either mathematically or with string<br>concatenation.<br>Sample runs<br>Enter a postive integer: 3456<br>3456 is not palindrome<br>Enter a postive integer: 45654<br>45654 is palindrome<br>

Extracted text: Q3. Create two methods: one that will reverse the order of the digits in an integer and a second determines if a number is a palindrome (i.e. reads the same front to back) using the following method headers. // Method 1: Takes in an integer and reverses it, e.g., reverse(456) returns 654 public static int reverse(int number) // Method 2: Takes in an integer and returns true if it is a palindrome. Use the reverse method you just wrote to implement this method. public static boolean isPalindrome(int number) Create a test program that asks the user to input an integer and provides feedback on whether the integer is a palindrome or not. Hint: To find the reverse number, use one of the following approaches: • Modify your numerical inputs to a string, then use a for loop to reverse the characters with string concatenation and the charAt() method. Retrieve individual digits and combine them in reverse order using the / and % operators, using ten as a divisor. Combine the digits with either mathematically or with string concatenation. Sample runs Enter a postive integer: 3456 3456 is not palindrome Enter a postive integer: 45654 45654 is palindrome

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here