23.9k views
1 vote
Add is a function that accepts two int parameters and returns their sum.

Two int variables, euro Sales and asia Sales, have already been declared and initialized. Another int variable, eurasia Sales, has already been declared.
Write a statement that calls add to compute the sum of euro Sales and asia Sales and store this value in eurasia Sales.

1 Answer

6 votes

Answer:

Solution code is written in Java.

  1. public static void main(String[] args) {
  2. int eurasiaSales = Add(10000, 20000);
  3. }
  4. public static int Add(int euroSales, int asiaSales){
  5. return euroSales + asiaSales;
  6. }

Step-by-step explanation:

Firstly, create a function Add() that takes two int parameters, euroSales and asiaSales. This function return the sum of euroSales and asiaSales (Line 5-6).

Next, we can simply call the function by passing two integers (place them in parenthesis). The returned value from the function will be assigned to variable eurasiaSales.

User Guoxin
by
5.6k points