Menu

(Solved) : Using Java Language Programming Try Solve Last Problem 1 Write Method Return Number Digits Q43959879 . . .

Using Java Language Programming, try to solve the lastproblem:

1. Write a method to return the number of digits in a longparameter.

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 ofa 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 bothmethods. Sample output:

Enter a number: 123 –> (User)
123 has 3 digits –> (Output)

sum = 6 –> (Output also)

Expert Answer


Answer to Using Java Language Programming, try to solve the last problem: 1. Write a method to return the number of digits in a lo…

OR