Using Pseudo code, design an algorithm that can sum the digits of an integer in

the range 100-999. For example, given a number 734, the answer would be 7 + 3

+ 4, which equals 14. Given 103 the sum would be 1 + 0 + 3, which equals 4.

Hint: in order to extract each digit (units, tens, hundreds etc.) from a given

number, think about using the division (/) and, or modulus of that number by

10 or multiples of 10.

Additional marks are available for an algorithm that can deal with any size of

number.

2. Complete the outline Java class below by,

Using the algorithm above to implement the sumOfDigits value method, which

accepts a number as a parameter and returns the sum of its digits.

Implement the main method that should prompt the user to input an integer

number then print the number and a message stating whether the sum of its

digits is equal to 10. Note - the user should be forced to enter a number between

100 and 999 inclusive. Sample program executions might look as follows

Input Number: 730

The sum of the digits of 730 is 10 and is equal to 10.

Input Number: 198

The sum of the digits of 198 is 18 and is NOT equal to 10.

// Sample outline class.

public class Sum

{

public static int sumOfDigits int number)

{

// complete method

}

public static void main(String[] args)

{

// complete method

}

}