Ask Question
11 July, 11:25

Write a method that takes three numerical String values and sums their values. For example, the call sumStrings ("1", "5", "7") would return 13. This is done in Java.

+3
Answers (1)
  1. 11 July, 11:42
    0
    public static int sumStrings (String s1, String s2, String s3) {

    int i1 = Integer. parseInt (s1);

    int i2 = Integer. parseInt (s2);

    int i3 = Integer. parseInt (s3);

    int sum = i1 + i2 + i3;

    return sum;

    }

    Explanation:

    - Create a method called sumStrings that takes three strings

    - Convert each string to integer using Integer. parseInt () method

    - Sum the strings

    - Return the result
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a method that takes three numerical String values and sums their values. For example, the call sumStrings ("1", "5", "7") would ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers