1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
aniked [119]
3 years ago
7

Write a method that takes three numerical String values and sums their values. For example, the call sumStrings("1", "5", "7") w

ould return 13. This is done in Java.
Computers and Technology
1 answer:
masha68 [24]3 years ago
7 0

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 <em>sumStrings</em> that takes three strings

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

- Sum the strings

- Return the result

You might be interested in
Write Java code that creates an array of n integers myArray, by taking n integers from the user with duplications, and do the fo
skad [1K]

Answer:

this should be what you need

Explanation:

import java.util.*;

public class ABC{

 public static void main(String[] args) {

   int n;

   //create scanner object

   Scanner sc = new Scanner(System.in);

   //ask for size of array

   System.out.print("Enter the size of array (n): ");

   //read the input

   n = sc.nextInt();

   //create an array of n length

   int [] myArray = new int[n];

   //ask user for array elements

   System.out.printf("Enter %d integers: ", n);

   //read array elements

   for(int i =0 ;i <5; i++)

     myArray[i] = sc.nextInt();

   

   //print the elements if myArray

   System.out.print("1 - The values of myArray are: [");

   for(int i =0 ; i < n; i++){

     System.out.print(myArray[i]);

     if(i < n-1)

       System.out.print(", ");

   }

   System.out.print("]\n");

   //calculate mean and sum of myArray elements

   int sum = 0;

   double mean = 0;

   for(int i = 0; i < n; i++)

     sum += myArray[i];

   

   mean = (sum*1.0)/n;

   //print the sum and mean of myArray

   System.out.printf("2 - The sum is: %d. The mean is: %.1f\n", sum, mean);

     

   //create an arraylist

   ArrayList<Integer> myArrayList = new ArrayList<Integer>();

   //copy the value of myArray to an arraylist without duplicates

   for(int i = 0; i < n; i++){

     if(!myArrayList.contains(myArray[i]))

       myArrayList.add(myArray[i]);

   }

   sum = 0; mean = 0;

   //display the values of myArrayList

   System.out.print("3 - The values of myArrayList are: [");

   for(int i =0 ; i < myArrayList.size(); i++){

     System.out.print(myArrayList.get(i));

     if(i < myArrayList.size()-1)

       System.out.print(", ");

   }

   System.out.print("]\n");

   //calculate sum and mean of myArrayList elements

   for(int i = 0; i < myArrayList.size(); i++)

     sum += myArrayList.get(i);

   mean = (sum*1.0)/myArrayList.size();

   //print the sum and mean of myArrayList

   System.out.printf("4 - The sum is: %d. The mean is: %.2f\n", sum, mean);

 }

}

3 0
3 years ago
The goal expressed in this definition states that data visualization is about ________________ .
RSB [31]

Answer:

4. Interpreting.

Explanation:

Data visualization is used to represent data using graphics. It narrates the values of data graphically, creating a relationship between the inputted group of data and the images being viewed by observers.

In big data technology, data visualization helps to show or interpret the large amount of data for both descriptive analysis and predictive analysis of the presented data. The communication of the data and image is made possible through the mapping of a graph marks and individual data sets or values.

8 0
3 years ago
Read 2 more answers
How do ethics affect people?
Mnenie [13.5K]
People are affected because ethics are suppose to be moral
5 0
3 years ago
What is the value of the variable result after these lines of code are executed?
notsponge [240]

Answer:

5

Explanation:

6 0
3 years ago
Read 2 more answers
WHY IS BRAINLY NOTIFICATIONS LIKE THIS?????
nikdorinn [45]

Answer:

probly the wifi connection

Explanation:

4 0
3 years ago
Read 2 more answers
Other questions:
  • Ascending and descending are examples of
    5·2 answers
  • What tab must you click on to view any previously read messages from instructors in the message center?
    14·2 answers
  • What does the rule of five say?
    12·2 answers
  • What do these terms have in common? google, yahoo!, bing they are important books. they are internet search engines. they are wo
    10·1 answer
  • Which of the following involves writing hidden messages so that only the sender and intended recipient know a message exists? St
    5·1 answer
  • Which of the following extends a network over a large geographic area by connecting local area networks together?
    14·2 answers
  • I CANT DO SKIN MODS ON BRAWLHALLA RIGHT!!!! IM SO MADDDDDDDDDDD
    11·1 answer
  • Describe how data is transmitted using half-duplex serial data transmission.
    9·1 answer
  • 8.5 Edhesive Code Practice
    14·1 answer
  • Which statement best describes what happens when a computer starts?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!