Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A function call for a void function named calcEndingInventory() is passed four i

ID: 3812644 • Letter: A

Question

A function call for a void function named calcEndingInventory() is passed four int variables named beginInventory, sales, purchases, and endingInventory. The function’s task is to calculate the ending inventory, using the beginning inventory, sales, and purchase amounts passed to the function. The function should store the result in the endingInventoryvariable. Which of the following function headers is correct?

void calcEndingInventory (int& b, int& s, int& p, int& e);

void calcEndingInventory (int b, int s, int p, int& e)

void calcEndingInventory (int b, int s, int p, int& e);

void calcEndingInventory (int b, int s, int p, int e)

a.

void calcEndingInventory (int& b, int& s, int& p, int& e);

b.

void calcEndingInventory (int b, int s, int p, int& e)

c.

void calcEndingInventory (int b, int s, int p, int& e);

d.

void calcEndingInventory (int b, int s, int p, int e)

Explanation / Answer

Answer is :

void calcEndingInventory (int b, int s, int p, int& e)

Sample program to test:

#include <iostream>

using namespace std;
void calcEndingInventory (int b, int s, int p, int &e)
{
e = b + s+ p;
}
int main()
{
int ee,bb = 1,ss = 2,pp = 3;
  
calcEndingInventory(bb,ss,pp,ee);
cout << "the value is " <<ee << endl;

return 0;
}

Output:

the value is 6

b.

void calcEndingInventory (int b, int s, int p, int& e)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote