Question
Write in JAVA Project 2: DigitsAA.java Write a program that will ask the user for an integer (MUST be integer data type). You will then
Write in JAVA
Project 2: DigitsAA.java
Write a program that will ask the user for an integer (MUST be integer data type). You will then report back to the screen how many digits the value has. For example, 25244 will report back that you have 5 digits. Your input must be read in as an integer and you must use some kind of loop to process the number of digits. Converting to a string and then counting the size is too easy of a shortcut. Allow the program to repeat until the user types a negative value.
Output Example (User input is marked with >>>. Everything else is what you print to the screen.)
Enter a number and I will tell you how many digits it has. Enter a negative number to exit.
>>> 100032123
Your number has 9 digit(s).
Enter a number and I will tell you how many digits it has. Enter a negative number to exit.
>>> 8
Your number has 1 digit(s).
Enter a number and I will tell you how many digits it has. Enter a negative number to exit.
>>> -5
Goodbye.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started