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

Use single subscripted array(s) to solve the following problem. A company pays i

ID: 3766918 • Letter: U

Question

Use single subscripted array(s) to solve the following problem. A company pays its sales people on a commission basis. The salespeople receive $200 per week plus 9 percent of their gross sales for that week. For example, a salesperson who grosses $3000 in sales in a week receives $200 plus 9% of $3000, or a total of $470.

Design a program that determines how many of the salespeople earned salaries in each of the following ranges:

$200-$299

$300-$399

$400-$499

$500-$599

$600-$699

$700-$799

$800-$899

$900-$999

$1000 and over

You will need to declare two arrays, one to hold the salary range and the other to accumulate the count of salespeople in that range.

When you have to check for a range you store either the lowest value in each range in the array and compare the salary to each of those values or you can store the highest value and compare to that. The only change will be the relational operator that you use for your comparison. Which ever figure you decide to use should be stored in a parallel array so that when you determine which range the sales fit into you have the subscript for the counter array already determined.

Your output should list the salary range and the number of salespeople in that range.

Submit a Flowchart or Pseudocode.

Explanation / Answer

*/ #include void calculateAndPrintInterval(int array[100],int arraySize); int calculateWage(int a); int main(void){ int inputArray[100]={0}; //for storing input int wageArray[100]={0}; //for storing wages sequentally int intervalArray[9]={0}; int i=0; int arraySize=0; printf("Enter employee gross sales ( -1 to end ):"); scanf("%d",&inputArray[i]); while (inputArray[i]!=-1) //for this guy to check whether -1 is given or not, printf scanf part have to be repeated! Because i is incremented bottom { wageArray[i]=calculateWage(inputArray[i]); printf("Employee wage is: %d ",wageArray[i]); arraySize++; i++; printf("Enter employee gross sales ( -1 to end ):"); scanf("%d",&inputArray[i]); //You have to enter a number before for "while" to check! } calculateAndPrintInterval(wageArray,arraySize-1); //arraySize must be decremented because it will be a subscript later return 0; } int calculateWage(int a){ return 200+a*9/100; } void calculateAndPrintInterval(int array[100],int arraySize){ int i; int storageArray[9]={0}; /* This block can be coded briefly as follows: * * if ( salary >= 200 && salary < 1000 ) { * ++salaries[ ( int ) salary / 100 ]; //f 900 is entered 9th subscript is entered. * } * else if ( salary >= 1000 ) { * ++salaries[ 10 ]; * } */ while(arraySize>=0){ if (array[arraySize]>=1000) storageArray[8]++; else if (array[arraySize]>=900) storageArray[7]++; else if (array[arraySize]>=800) storageArray[6]++; else if (array[arraySize]>=700) storageArray[5]++; else if (array[arraySize]>=600) storageArray[4]++; else if (array[arraySize]>=500) storageArray[3]++; else if (array[arraySize]>=400) storageArray[2]++; else if (array[arraySize]>=300) storageArray[1]++; else storageArray[0]++; arraySize--; } printf(" "); printf("$200-$299 : %d ",storageArray[0]); printf("$300-$399 : %d ",storageArray[1]); printf("$400-$499 : %d ",storageArray[2]); printf("$500-$599 : %d ",storageArray[3]); printf("$600-$699 : %d ",storageArray[4]); printf("$700-$799 : %d ",storageArray[5]); printf("$800-$899 : %d ",storageArray[6]); printf("$900-$999 : %d ",storageArray[7]); printf(">>>$1000 : %d ",storageArray[8]); getch();}