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: 3739177 • 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 configuration you decide to use should be duplicated in a parallel counter 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.

Don't forget to include modules in your solution.

Pseudocode can be submitted as a Word, .rft. or .txt file.

Flowcharts may be created in a software program designed for flowcharting. Most will allow you to export or print your solution as a .pdf file that you can upload here.

I need the answer to include flowchart and pseudcolde . We are using the book Programming Logic and Design.

Instructions

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 configuration you decide to use should be duplicated in a parallel counter 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.

Don't forget to include modules in your solution.

Pseudocode can be submitted as a Word, .rft. or .txt file.

Flowcharts may be created in a software program designed for flowcharting. Most will allow you to export or print your solution as a .pdf file that you can upload here.

I need the answer to include flowchart and pseudcolde . We are using the book Programming Logic and Design.

Explanation / Answer

Please find my implementation:

7 #include <stdio.h>
8
9 /* Function prototypes */
10 void getsales(int count[]);
11 void printranges(int count[]);
12
13 int main(void)
14 {
15 /* Declare variables and initialize variables to 0 */
16 int count[11] = {0, /* not used */
17 0, /* not used */
18 0, /* $200-$299 */
19 0, /* $300-$399 */
20 0, /* $400-$499 */
21 0, /* $500-$599 */
22 0, /* $600-$699 */
23 0, /* $700-$799 */
24 0, /* $800-$899 */
25 0, /* $900-$999 */
26 0}; /* $1000 and over */
27
28 /* Call function getsales() to get employee's weekly gross sales */
29 getsales(count);
30
31 /* Call function printranges() to print the table of the number of employees in the different salary ranges */
32 printranges(count);
33
34 return 0;
35 }
36
37 /**********************getsales**************************
38 * Description: This function keeps prompting the user
39 * to input employees' weekly gross sales
40 * until they press control-d
41 * Parameters: integer array to hold the count of
42 * employee's in the different salary
43 * ranges
44 * Return: none
45 ********************************************************/
46 void getsales(int count[])
47 {
48 /* Declare variables and initialize variables to 0 */
49 int salary = 0;
50 float sales = 0;
51
52 /* Prompt user for an employee's weekly gross sales, user will enter control-d to end entries */
53 printf ("Enter an employee's weekly sales (control-d to end): ");
54
55 /* While not end of input */
56 while (scanf("%f", &sales) != EOF)
57 {
58
59 /* Calculate this latest employee's weekly salary */
60 salary = 200 + .09 * sales;
61
62 /* Determine and increment the corresponding array element for the salary range */
63 if (salary >= 1000)
64 {
65 count[10]++;
66 }
67 else if (salary >= 200)
68 {
69 count[salary / 100]++;
70 }
71
72 /* Prompt user for an integer value, user will enter control-d to end entries */
73 printf ("Enter an employee's weekly sales (control-d to end): ");
74 }
75 }
76
77 /**********************printranges***********************
78 * Description: This function prints the number of
79 * employees in each of the nine different
80 * salary ranges
81 * Parameters: integer array that holds the count of
82 * employee's in the different salary
83 * ranges
84 * Return: none
85 ********************************************************/
86 void printranges(int count[])
87 {
88 int i;
89
90 printf("Employees in salary range: ");
91 for (i = 2; i < 10; i++)
92 {
93 printf("$%d00 - $%d99: %d ", i, i, count[i]);
94 }
95 printf("$1000 and over: %d ", count[10]);
96 }