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

Please help me with this problem, as I am trying to finish it. I need correct an

ID: 3604243 • Letter: P

Question

Please help me with this problem, as I am trying to finish it. I need correct answers please, screenshot and code will be extremely helpful!

AWK The Pseudocode

Below is a pseudo-code to help you write the program.

BEGIN{

set FS to a comma

print the header

}

{
if (NR > 1) # this test skips the first line of the file {

Set individualTotal and individualCount to zero

for (field=3; field <=5; field++) {

if ($field >= 0) {

add contents of $field to individualTotal add one to individualCount

# Now update the testTotal and testCount arrays
# subtract 2 from the field number so that our arrays begin at 1 add contents of $field to testTotal indexed by (field-2)
add 1 to testCount array indexed by (field-2)

# Use contents field 2 as the index for the team array

add contents of $field to teamTotal array indexed by $2

add 1 to teamCount array indexed by $2

} }

print the person's name and his individual average

} }

END {
print "------------------" for (n=1; n<=3; n++) {

print average for test n using testTotal and testCount arrays }

print "------------------"

print average for "Red" team
print average for "Green" team
print average for "Blue" team
(these all use the teamTotal and teamCount arrays)

}

Explanation / Answer

BEGIN{

set FS to a comma

print the header

}

{
if (NR > 1) # this test skips the first line of the file {

Set individualTotal and individualCount to zero

for (field=3; field <=5; field++) {

if ($field >= 0) {

add contents of $field to individualTotal add one to individualCount

# Now update the testTotal and testCount arrays
# subtract 2 from the field number so that our arrays begin at 1 add contents of $field to testTotal indexed by (field-2)
add 1 to testCount array indexed by (field-2)

# Use contents field 2 as the index for the team array

add contents of $field to teamTotal array indexed by $2

add 1 to teamCount array indexed by $2

} }

print the person's name and his individual average

} }

END {
print "------------------" for (n=1; n<=3; n++) {

print average for test n using testTotal and testCount arrays }

print "------------------"

print average for "Red" team
print average for "Green" team
print average for "Blue" team
(these all use the teamTotal and teamCount arrays)

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote