A number with the same digits from either end is called a palindrome. Examples are: 16261, 93439, and 20102. Write a program that accepts a 5-digit number from the user. Now, tell the user if the number s/he entered is a palindrome.

Your program should then proceed to print all the 5-digit palindrome numbers that are divisible by 17 and the sum of the digits of each number in a table as shown below. Also print the total number of 5-digit palindrome numbers that are divisible by 17.

Sample Run of the program:

Please enter a 5 digit number: 12321

You entered a palindrome

Table of 5 digit palindromes divisible by 17 and the sum of their digits:

Palindrome Sum of Digits

11611 10

12121 7

… …

… …

… …

98889 42

99399 39

There were a total of _?_ 5-digit Palindromes divisible by 17.

**************************************…

My original program:

import javax.swing.JOptionPane; public class Assignment2222 { public static void main(String[] args) { char firstChar = '0'; char secondChar = '1'; char thirdChar = '2'; char fourthChar = '3'; char fifthChar = '4'; String numberInput; int number; numberInput = JOptionPane.showInputDialog("\nPlease enter a 5-digit number: "); number = Integer.parseInt(numberInput); firstChar = numberInput.charAt(0); secondChar = numberInput.charAt(1); thirdChar = numberInput.charAt(2); fourthChar = numberInput.charAt(3); fifthChar = numberInput.charAt(4); if (firstChar == fifthChar && secondChar == fourthChar) { JOptionPane.showMessageDialog(null, "This is a Palindrome."); } else { JOptionPane.showMessageDialog(null, "Error: This is not a Palindrome."); } } }

**************************************…

I realize there are several ways to do this. I posted the way I chose to do this w/ my basic, limited java skills. Since I'm really new to java, I decided to use char. I cant use Reverse method, or string arrays (string literals are ok). I have gotten the program to check if the user entered a Palindrome or not, but now I need to print out all 5 digit Palindromes divisible by 17 and the sum of the digits of each number. I think this is going to use increment, or decrement, but I have a lot of trouble using ++, -- properly. I realize its extremely important where you put these (pre, post). Can anybody please help me? Thanks in advance!!