Write a method that takes in an integer and does the following: 1. Discards all but the last two digits 2. Reverses the remaining digits 3. Adds the number formed by the discarded digits (0 if no...


Java.


Write a method that takes in an integer and does the following:<br>1. Discards all but the last two digits<br>2. Reverses the remaining digits<br>3. Adds the number formed by the discarded digits (0 if no digits were discarded) to the number formed<br>by the remaining (reversed) digits<br>4. Return all of these results in a string (see example for formatting)<br>If the input number is less than 2 digits, return the string

Extracted text: Write a method that takes in an integer and does the following: 1. Discards all but the last two digits 2. Reverses the remaining digits 3. Adds the number formed by the discarded digits (0 if no digits were discarded) to the number formed by the remaining (reversed) digits 4. Return all of these results in a string (see example for formatting) If the input number is less than 2 digits, return the string "Number too small!" You can assume that all of the input numbers will be positive integers that consist only of the digits 1-9 (no zeroes). Example: problem4 reverseAndAdd ( 89877); // returns "Input: 89877, Last 2 digits: 77, Reversed: 77, Sum: 975" problem4 reverseAndAdd (8); // returns "Number too small!" problem4 reverseAndAdd (371); // returns "Input: 371, Last 2 digits: 71, Reversed: 17", Sum: 20"

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here