Question: Write a java program (SumDigits) as follows: The main method prompts the user to enter an integer number. The method then calls Method Sum()(defined blew)

Write a java program (SumDigits) as follows:

The main method prompts the user to enter an integer number. The method then calls Method Sum()(defined blew) to add the digits and return their total. The main method then prints the digits total with proper label as shown below.

Method Sum()is of type integer and takes an integer value. The method recursively adds up the digits and returns their total. Document your code and use proper prompts for inputs and format outputs as shown below.

Entered integer: 123456

Digits sum: 21

Entered integer: 111111

Digits sum: 6

Entered integer: 55555

Digits sum: 25

Entered integer: 1010101010

Digits sum: 5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!