Ask Question
23 June, 08:14

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.

+1
Answers (1)
  1. 23 June, 09:20
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers