Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program to read an integer number and find its number of digits (for exa

ID: 3620384 • Letter: W

Question

Write a program to read an integer number and find its number of digits (for example, 3459 has 4 digits and 125860 has 6 digits).

The program should be designed in a way that the user could test as many numbers as desired without leaving the program. Use only long integer ( int or long int ) data type in this problem; however make sure that the program rejects any input outside the long integer data range(about -2,000,000,000 to +2,000,000,000).

The outputs of the program should be written to an output file having a format exactly like the following table.



VALUE ENTERED NUMBER OF DIGITS
1241 4
19 2
5684900 7
0 1
1267678901 10
-153 3
62000 5




Test the program for at least seven integer values between ± 2,000,000,000 and a number outside the long int data range . Remember to submit a copy of the program file and a copy of the output file.





Explanation / Answer

Dear... // program code for count digits in integer import java.io.*; public class Count { Public static void main (String [ ] args) { Scanner in = new Scanner(System.in); int cnt; int numPlace(int num) { while (num > 0 ) { int r = num % 10; cnt++; num = num / 10; System.out.println("The number"+num); } return cnt; } } class placeCount { public static void main(String[] args) { int cnt; Count n = new Count( ); cnt = n.numPlace(50); System.out.println("The count of the number places "+cnt); } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote