values entered in the sample run 10, 333, -12321, and12321
Question Four (15 marks): A non-negative integer is a palindrome if it reads forwrard and backward in the same way. For example, the intergers 5, 44, 434, 1881, and 789656987 are all palindromes. Write a Java program that the palindrome function. Your program should have the following two methods: • isNumralidrome method which has only one formal parameter. This parameter should be a non-negative interger. The method will return true if the number is a palindrom and false otherwise. • main method that prompts the user to enter a non-negative integer number and print if the number is palindrome or not. Test your program on the following numbers: 10, 34, 333, 67876, and 12345321. Sample run: 0 Enter a non-negative integer number: 10 is not a palindrome Enter a non-negative integer number: 1 333 is a palindrome 1221 Enter a non-negative integer number: Invalid input! Try again Enter a non-negative integer number: 12321 is a palindrome Show transcribed image text Question Four (15 marks): A non-negative integer is a palindrome if it reads forwrard and backward in the same way. For example, the intergers 5, 44, 434, 1881, and 789656987 are all palindromes. Write a Java program that the palindrome function. Your program should have the following two methods: • isNumralidrome method which has only one formal parameter. This parameter should be a non-negative interger. The method will return true if the number is a palindrom and false otherwise. • main method that prompts the user to enter a non-negative integer number and print if the number is palindrome or not. Test your program on the following numbers: 10, 34, 333, 67876, and 12345321. Sample run: 0 Enter a non-negative integer number: 10 is not a palindrome Enter a non-negative integer number: 1 333 is a palindrome
1221 Enter a non-negative integer number: Invalid input! Try again Enter a non-negative integer number: 12321 is a palindrome
Expert Answer
Answer to Question Four (15 marks): A non-negative integer is a palindrome if it reads forwrard and backward in the same way. For …