boo6931
01.11.2019 •
Computers and Technology
"add" is a method that accepts two int arguments and returns their sum .two int variables , eurosales and asiasales, have already been declared and initialized . another int variable , eurasiasales, has already been declared .write a statement that calls add to compute the sum of eurosales and asiasales and that stores this value in eurasiasales.assume that add is defined in the same class that calls it.
Solved
Show answers
More tips
- H Health and Medicine How Did Inna Lose Weight on Dom 2?...
- H Health and Medicine Coughing: Causes, Types, and Treatment Methods...
- H Health and Medicine How to Treat the Flu: A Comprehensive Guide...
- O Other What is a Disk Emulsifier and How Does it Work?...
- F Family and Home What does a newborn need?...
- F Family and Home Choosing the Right Car Seat for Your Child: Tips and Recommendations...
- F Food and Cooking How to Get Reconfirmation of Registration?...
- C Computers and Internet How to Get Rid of Spam in ICQ?...
- A Art and Culture Who Said The Less We Love a Woman, the More She Likes Us ?...
- F Family and Home How to Get Rid of Your Neighbors?...
Answers on questions: Computers and Technology
- M Mathematics Is 5 quarts equal, less, or greater than 20 cups?...
- H History Which statement best summarizes what you’ve learned about students and free speech? students, like all americans, have unlimited rights to free speech. students have no more limits...
- H History What effect did the tang dynasty have on the civil service system?...
- M Mathematics If δlmn ≅ δ xyz, which statement is true? a) nl≅zx b) ml≅xz c) ln≅yz d) zy≅ml...
- C Computers and Technology Zack wants to learn a programming language to create games and applications. this program language will also him create web applications. which language should he learn....
- B Biology How many types of spiders are there? !...
- B Biology Which of the following models the behavior of a solar prominence best? a. a glacier melting slowly on a mountain top b. a tall ocean wave caused by blowing wind c. air being blown...
- M Mathematics Someone i dont know what mean is mean is not supposed to be in mathematics im confuse it says: find the mean age of the swimmers on the team....
- E English Which type of literary theory would examine the relationship between the poem and billy collins? mimetic expressive rhetorical formal...
- M Mathematics The sum of three consecutive odd numbers is 177. what is the smallest of the three numbers?...
Ответ:
The answer to this question can be given as:
Statement:
//declare method add with two-parameter.
public static int add(int euroSales, int asiaSales)
{
return euroSales+asiaSales;
//return value.
}
public static void main(String[] args)
//declare main function
{
int eurasiaSales;
//declare integer variable
eurasiaSales=add(4,7);
//calling function by passing value in arguments.
//variable hold return value.
System.out.print("Sum is:"+eurasiaSales); //print value.
}
Explanation:
In the above statement firstly we declare the function that name is already given in the question that is add() function. In this function, we pass two integer variables as a parameter that is euroSales and asiaSales. This function returns the sum of passing variable. Then we declare the main function in that function we declare an integer variable that is eurasiaSales that hold the return values of the add function in the last we print eurasiaSales variable value.
Ответ:
2
14
8
respectively.
cout << values[4] << endl; 2
cout << (values[2] + values[3]) << endl; 14
cout << ++values[1] << endl; 8
Explanation:
The code is written in C++
int values[5] = { 4, 7, 6, 8, 2 };The code above is an array with a length of 5.
In C++ indexing starts from "0". In this array we have 5 elements stores in index 0,1,2,3 and 4.
0 = 4
1 = 7
2 = 6
3 = 8
4 = 2
cout << values[4] << endl; 2prints out the value stored in index [4] which is 2.
cout << (values[2] + values[3]) << endl; 14adds(+) the values stored in index [2] and [3]. i.e. 6+8 = 14. it then prints out the summation.
cout << ++values[1] << endl; 8(++value increases the value by 1.)
prints out the increment of the value stored in index[1]. i.e. 1+7=8