a) $200-299 b) $300-399 c) $400-499 d) $500-599 e) $600-699 f) $700-799 g) $800-899 h) $900-999 i) $1000 and over

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Write comments in the below code explaining each line . Show it in a picture. Arrays Sales Commissions Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $3,000 in sales in a week receives $200 plus 9% of 3,000, or a total of $470. Write a C program (using an array of counters that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer.) a) $200-299 b) $300-399 c) $400-499 d) $500-599 e) $600-699 f) $700-799 g) $800-899 h) $900-999 i) $1000 and over
#include <stdio.h>
9 int main (void)
10 {
int salesperson[9]
int gross = 0;
int commission = 0;
11
{0};
12
13
14
while(gross != -1)
{
printf("Enter gross sales (-1 to End): ");
scanf ("%d", &gross);
15
16
17
18
19
20
if (commission >= 200 && commission <= 299)
21
22
salesperson[e]++;
23
24
25
if (commission >= 300
commission < 399)
26
27
salesperson[1]++;
28
29
30
if (commission >= 400 && commission <= 499)
31
salesperson[2]++;
}
32
33
34
35
if (commission >= 500 && commission <= 599)
36
37
salesperson[3]++;
38
39
if (commission >= 600 && commission <= 699)
{
salesperson[4]++;
40
41
42
43
44
if (commission >= 700 && commission < 799)
{
salesperson[5]++;
45
46
47
48
49
if (commission >= 800 && commission <= 899)
{
salesperson[6]++;
50
51
52
53
54
if (commission >= 900 && commission <= 999)
{
55
56
Transcribed Image Text:#include <stdio.h> 9 int main (void) 10 { int salesperson[9] int gross = 0; int commission = 0; 11 {0}; 12 13 14 while(gross != -1) { printf("Enter gross sales (-1 to End): "); scanf ("%d", &gross); 15 16 17 18 19 20 if (commission >= 200 && commission <= 299) 21 22 salesperson[e]++; 23 24 25 if (commission >= 300 commission < 399) 26 27 salesperson[1]++; 28 29 30 if (commission >= 400 && commission <= 499) 31 salesperson[2]++; } 32 33 34 35 if (commission >= 500 && commission <= 599) 36 37 salesperson[3]++; 38 39 if (commission >= 600 && commission <= 699) { salesperson[4]++; 40 41 42 43 44 if (commission >= 700 && commission < 799) { salesperson[5]++; 45 46 47 48 49 if (commission >= 800 && commission <= 899) { salesperson[6]++; 50 51 52 53 54 if (commission >= 900 && commission <= 999) { 55 56
c main.c
assignment 15 )
assignment 15
c main.c main()
48
49
50
if (commission >= aee && commission <= 899)
51
52
salesperson[6]++;
53
54
if (commission >= 980 && commission <= 999)
{
salesperson[7]++;
55
56
57
58
59
if (commission >= 1000)
{
salesperson[8]++;
60
61
62
63
64
65
commission = 200 + (.09 * gross);
66
printf("a) $208-299: %d\n", salesperson[e]);
printf("b) $300-399: %d\n", salesperson[1]);
printf("c) $400-499: %d\n", salesperson[2]);
printf("d) $500-599; %d\n", salesperson[3]);
printf("e) $600-699: %d\n" , salesperson[4]);
printf("f) $700-799: %d\n", salesperson[5]);
printf("g) $800-899: %d\n", salesperson[6]);
printf("h) $900-999: %d\n", salesperson[7]);
printf("i) $1000 and over: %d\n", salesperson[8]);
67
68
69
70
71
72
73
74
75
76
77
78
return e;
79 }
80
81
Transcribed Image Text:c main.c assignment 15 ) assignment 15 c main.c main() 48 49 50 if (commission >= aee && commission <= 899) 51 52 salesperson[6]++; 53 54 if (commission >= 980 && commission <= 999) { salesperson[7]++; 55 56 57 58 59 if (commission >= 1000) { salesperson[8]++; 60 61 62 63 64 65 commission = 200 + (.09 * gross); 66 printf("a) $208-299: %d\n", salesperson[e]); printf("b) $300-399: %d\n", salesperson[1]); printf("c) $400-499: %d\n", salesperson[2]); printf("d) $500-599; %d\n", salesperson[3]); printf("e) $600-699: %d\n" , salesperson[4]); printf("f) $700-799: %d\n", salesperson[5]); printf("g) $800-899: %d\n", salesperson[6]); printf("h) $900-999: %d\n", salesperson[7]); printf("i) $1000 and over: %d\n", salesperson[8]); 67 68 69 70 71 72 73 74 75 76 77 78 return e; 79 } 80 81
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY