Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, please help me solve this, I don't know what is wrong with my code. Loop processing with arrays Keeping count of array elements that

Hello, please help me solve this, I don't know what is wrong with my code.

Loop processing with arrays

Keeping count of array elements that are being used

Parallel Arrays: Two or more arrays whose corresponding elements

refer to related information.

#include

#include

using namespace std;

//------------------------------------------------------------------------------

int main()

{

const int MAX_EMP = 5;

int employeeIds[MAX_EMP] = { 1001, 2034, 5529, 7661, 8999 };

double employeeWages[MAX_EMP];

char response;

int count=0;

do {

cout<<"Enter wages for employee "<

cin>>employeewages[MAX_EMP];

count++;

if(count

{

cout<<"Another (y or n): ";

cin>>response;

response= toupper(response);

}

}

while(response=='Y'&& count

cout<

cout<<"IDWage"<

double total=0.0;

double indexOfSmallest=0;

for(int k=0; count; k++)

{

cout <<"Average Wage: "<<(total/count)<

cout<<"Largest wage found is $"<

cout<<"Smallest wage found for employee"<

}

cout << " End Program - ";

return 0;

}

//------------------------------------------------------------

/*Sample Program Output with exactly MAX_EMP wages...

--------------------------------------------------------------

Enter wages for employee 1001: 10

Another (y or n): y

Enter wages for employee 2034: 20.50

Another (y or n): y

Enter wages for employee 5529: 15.25

Another (y or n): y

Enter wages for employee 7661: 9.95

Another (y or n): y

Enter wages for employee 8999: 24.10

IDWage

1001: $ 10.00

2034: $ 20.50

5529: $ 15.25

7661: $9.95

8999: $ 24.10

Average Wage: $15.96

Largest wage found is $24.10

Smallest wage found is for employee 7661: $9.95

End Program - Press any key to continue . . .

===============================================================

Sample Program Output with fewer than MAX_EMP wages...

===============================================================

Enter wages for employee 1001: 20.50

Another (y or n): y

Enter wages for employee 2034: 10

Another (y or n): y

Enter wages for employee 5529: 15.55

Another (y or n): n

IDWage

1001: $ 20.50

2034: $ 10.00

5529: $ 15.55

Average Wage: $15.35

Largest wage found is $20.50

Smallest wage found is for employee 2034: $10.00

End Program - Press any key to continue . . .

*/

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Fluid filled cavity in the brain is called as........?

Answered: 1 week ago

Question

Which part of the brain controls emotions experience?

Answered: 1 week ago

Question

What part of a neuron responsible for receiving information?

Answered: 1 week ago

Question

In evolutionary terms with is the oldest pat of the brain ?

Answered: 1 week ago

Question

The limbic system includes?

Answered: 1 week ago