Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA **6.3 Using multiple methods ( 10 points ): Palindromes are numbers or words that are same when read from either end. Eg. Avid diva,

JAVA **6.3 Using multiple methods (10 points): Palindromes are numbers or words that are same when read from either end. Eg. Avid diva, civic, 12321, 52925. Write a java program PalindromeByMethods.java that reads in an integer number (any number of digits up to 10 digits) from user input. The program then passes this number on to a method called reportIfPalindrome( ) that returns a boolean value. The method reportIfPalindrome( ) makes a call to another method called reverseNum(int number) that returns the reverse of the original integer back to the reportIfPalindrome( ) method. Based on the original integer and its reversed value received from the reverseNum( ) method, the reportIfPalindrome( ) method decides if the number is a palindrome and passes this information back (a Boolean value) to the main( ) method. Based on the returned value, the main( ) method prints if or not the number is a palindrome. [If you wrote a numOfDigits( ) method for the last program, it will be useful for this program too.]

.

Sample Run 1

This program checks if a user-entered number is a palindrome. Please enter the number: 1234 Printed from main( ): The number entered is: 1234

Making a call to reportIfPalindrome ( ) Now in method reportIfPalindrome ( ) The number received from main( ) is: 1234 Passing the number to reverseNum( ) Result received from reverseNum( )

The reverse of the received number 1234 is 4321. Reporting my decision back to main( ) Back in main( ) The number 1234 is NOT a Palindrome.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

=+Why does the brand want to advertise?

Answered: 1 week ago

Question

5. What information would the team members need?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago