Part-2: In your main class write the following methods: 1. A method named reverse that takes an integer and returns the reversal of the passed integer. The header of the method is as follows: public static int reverse(int x) For example, if the number 6823 is passed in x, the method must return the integer 3286. 2. A method named isPalindrome that takes an integer number and returns true if it's a palindrome and false otherwise. A number is a palindrome if its reversal is the same as itself. The header of the method is as follows: public static boolean isPalindrome(int number) For example: The number 12321 is a palindrome. The number 12357 is not a palindrome. 3. A method named printPalindromes, that takes two integers il and i2 and prints all palindrome numbers between il and i2 inclusive, comma separated on one line, then prints a new line. The method must first make sure that il is less than i2. If not, it must print the statement: "Invalid range" The header of the method is as follows: public static void printPalindromes(int il, int i2) 4. In your main method invoke the printPalindromes method to print palindromes in the following ranges: 1000-2000 2500-3000 3000-2000

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

java ..... please solve the questions 3 and 4

Part-2: In your main class write the following methods:
1. A method named reverse that takes an integer and returns the reversal of the passed
integer.
The header of the method is as follows:
public static int reverse(int x)
For example, if the number 6823 is passed in x, the method must return the integer 3286.
2. A method named isPalindrome that takes an integer number and returns true if it's a
palindrome and false otherwise. A number is a palindrome if its reversal is the same as
itself.
The header of the method is as follows:
public static boolean isPalindrome(int number)
For example:
The number 12321 is a palindrome.
The number 12357 is not a palindrome.
3. A method named printPalindromes, that takes two integers il and i2 and prints all
palindrome numbers between il and i2 inclusive, comma separated on one line, then
prints a new line.
The method must first make sure that il is less than i2. If not, it must print the statement:
"Invalid range"
The header of the method is as follows:
public static void printPalindromes(int il, int i2)
4. In your main method invoke the printPalindromes method to print palindromes in the
following ranges:
1000-2000
2500-3000
3000-2000
Transcribed Image Text:Part-2: In your main class write the following methods: 1. A method named reverse that takes an integer and returns the reversal of the passed integer. The header of the method is as follows: public static int reverse(int x) For example, if the number 6823 is passed in x, the method must return the integer 3286. 2. A method named isPalindrome that takes an integer number and returns true if it's a palindrome and false otherwise. A number is a palindrome if its reversal is the same as itself. The header of the method is as follows: public static boolean isPalindrome(int number) For example: The number 12321 is a palindrome. The number 12357 is not a palindrome. 3. A method named printPalindromes, that takes two integers il and i2 and prints all palindrome numbers between il and i2 inclusive, comma separated on one line, then prints a new line. The method must first make sure that il is less than i2. If not, it must print the statement: "Invalid range" The header of the method is as follows: public static void printPalindromes(int il, int i2) 4. In your main method invoke the printPalindromes method to print palindromes in the following ranges: 1000-2000 2500-3000 3000-2000
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY