Create a Java class that accepts a number The input number must be between 10 and 99. You must validate this. If the input number is outside of this range, output a message "Invalid Input" and exit the program. If its a valid number: Check if  the square of the sum of its digits is equal to the input number If the square of the sum of its digits is not equal to the input number, find the reverse of the number and display it.   For example: Input: 81 Output: 81 because 81 = (8 + 1)2   Input: 23 Output: 32 because 23 is not equal to (2 + 3)2

EBK JAVA PROGRAMMING
8th Edition
ISBN:9781305480537
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 4PE
icon
Related questions
Question

Create a Java class that accepts a number

The input number must be between 10 and 99. You must validate this. If the input number is outside of this range, output a message "Invalid Input" and exit the program.

If its a valid number:

Check if  the square of the sum of its digits is equal to the input number

If the square of the sum of its digits is not equal to the input number, find the reverse of the number and display it.

 

For example:

Input: 81

Output: 81 because 81 = (8 + 1)2

 

Input: 23

Output: 32

because 23 is not equal to (2 + 3)2

Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Files and Directory
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT