Question: Problem #2 Write a method named palindromeAddNumber in Java that accepts an integer parameter and repeatedly adds the integer to the reversal of itself (the

Problem #2 Write a method named palindromeAddNumber in Java that accepts an integer parameter and repeatedly adds the integer to the reversal of itself (the integer constructed by reversing the order of the digits) until the result is a palindrome (an integer that is the same when the order of its digits is reversed). Your method should print a single line of output containing the number of adds that were needed, followed by a space, followed by the palindrome that was computed. For example, the call of palindromeAddNumber(195); should print: 4 9339 because: 195 (initial number) + 591 add #1 786 + 687 add #2 1473 + 3741 add #3 5214 + 4125 add #4 9339 (resulting palindrome)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!