Ask Question

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.

Answers (1)
  1. 23 October, 23:29
    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?
Find 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 the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers
Sign In
Ask Question