Question: ANSWER IN C++ Write a main routine in which you create an 2-D array of Employee x[2][3]. Set the values for all the elements of

ANSWER IN C++

Write a main routine in which you create an 2-D array of Employee x[2][3]. Set the values for all the elements of the array as follows:

Age

Id

Salary

x[0][0]

30

111

30000

x[0][1]

31

112

31000

x[0][2]

32

113

32000

x[1][0]

33

114

33000

x[1][1]

34

115

34000

x[1][2]

35

116

35000

Then, pass the array to a function, PrintEmployee(arg1, arg2, arg3), in which arg1 should be the array of Employee, arg2 is the length of the first dimension of the array (=2 in this case), and arg3 is the length of the second dimension of the array (=3 in this case). In PrinteEmployee(arg1, arg2, arg3), write a for loop to print out the information of each employee (in this case, we have six employees in total). In addition, an average age and an average salary should be also printed out.

The skeletons of the main( ) and PrintEmployee() are as follows:

void main( )

{

// create an array of Employee with two elements

..

// set the values for all the elements of the array by using public member functions

// call PrintEmployee( ) with a proper parameter list

PrintEmplyee( arg1, arg2, arg3);

}

void PrintEmployee(arg1, arg2, arg3)

{

// for loop

.

// print out an average age and an average salary

.

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!