jcruiz1637 jcruiz1637
  • 08-04-2020
  • Computers and Technology
contestada

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.

Respuesta :

frknkrtrn
frknkrtrn frknkrtrn
  • 09-04-2020

Answer:

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

Answer Link

Otras preguntas

identify the belief system that spread to China from India during the late Han period and appealed to the people during the trubuleng times
Are scorpions crustaceans?
In the mantle, heat is transferred as soft rock flows slowly in cycles known as ______ currents.
Identify the individual who was responsible for explaining the circulatory system.
what is the supreme law of the land
Identify the individual who was responsible for explaining the circulatory system.
a 5 letter word that means removing hair?what is the word
compare and contrast area and volume
history of spherical mirrors in human civilization
the line connecting two dots on a sheet of paper lies on the same sheet of paper as the dots. what is the patulate that justifies each statement?