Given that add, a function that expects two int parameters and returns their sum, and given that two variables, euro_sales and asia_sales, have already been defined: Write a statement that calls add to compute the sum of euro_sales and asia_sales and that associates this value with a variable named eurasia_sales.

Respuesta :

Answer:

The answer to this question can be given as:

Statement:

//declare method add with two-parameter.

public static int add(int euro_sales, int asia_sales)  

{

  return  euro_sales+asia_sales;

  //return value.

}

public static void main(String[] args)  

//declare main function

{

int eurasia_sales;

 //declare integer variable

eurasia_sales=add(4,7);

 //calling function by passing value in arguments.  

//variable hold return value.

System.out.print("Sum is:"+eurasia_sales);   //print value.

}

Explanation:

In the above statement, we declare the add() function that is already given in the question. In this function, we pass two integer variables euro_sales and asia_sales as a parameter. This function adds the parameter and returns value. Then we declare the main function. In this function, we declare an integer variable that is eurasia_sales that holds the return values of the add function. At the last, we print eurasia_sales variable value.

ACCESS MORE