Question
Using Java Language Programming, try to solve the last problem: 1. Write a method to return the number of digits in a long parameter. Ex.
Using Java Language Programming, try to solve the last problem:
1. Write a method to return the number of digits in a long parameter.
Ex. given 189 the method should return 3
Ex. given 203758 the method should return 6
2. Write a second method that displays the sum of the digits of a long parameter.
Ex. given 189 the method should return 18
Ex. given 203758 the method should return 25
3. Write a main method to test the methods in question 1 and 2. You should get an input value from the keyboard and then call both methods. Sample output:
Enter a number: 123 --> (User) 123 has 3 digits --> (Output)
sum = 6 --> (Output also)
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