Define a function named average_grade. This function returns a double and has four double arguments, test1, test2, test3, test4. The return value should be the average, or arithmetic mean of the four arguments. Be sure to include a comment that tells briefly what the function does.

What will be an ideal response?


```
// returns arithmetic mean of the arguments test1 - test4
double average_grade (double test1-, double test2,
double test3, double test4)
{
double average;
average = (test1 + test2 + test3 + test4) / 4;
return average;
}
```

This slightly more terse definition is sufficient:
```
//returns arithmetic mean of the arguments test1 - test4
double average_grade (double test1, double test2,
double test3, double test4)
{
return (test1 + test2 + test3 + test4) / 4;
}
```

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. Any if-else-if statement can alternatively be coded as a nested if-else statement. 2. A series of deeply nested if-else statements is usually easier to follow than the logic of an if-else-if statement. 3. In order for an && expression to be true, only the expression on one side of the && operator needs to be true. 4. For an || expression to be true, the expression on the left side of the || operator must be false. 5. If the expression on the left side of the || operator is true, the expression on the right side is not checked.

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 1The Reports team at TPG International has just hired Maeve as a report writer. She will be responsible for interviewing an internal customer to determine his or her reporting needs, and then design a report that best fits these needs. Because Maeve herself has joined the staff, her manager asked her to generate a new phone list for TPG International, which will include her name and extension. Which of the following will Maeve use for this report?

A. Detailed tabular B. Grouped C. Multiple columns D. Detailed columnar

Computer Science & Information Technology

Critical Thinking QuestionsCase 5-2Eric had a small reference card that he keeps handy to remind him which MsgBoxButton arguments values translate to which buttons in the dialog box, but then he lost the card. He calls over to you for help in reminding him what values correspond to what.Eric wants your help in remembering which of the following options corresponds to a dialog box that alerts the user to an error and offers the OK and Cancel buttons. What do you tell him? a. MsgBox("User name is missing", 0 Or 32, "User Name Error")c. MsgBox("User name is missing", 1 Or 64, "User Name Error")b. MsgBox("User name is missing", 0 Or 48, "User Name Error")d. MsgBox("User name is missing", 1 Or 16, "User Name Error")

What will be an ideal response?

Computer Science & Information Technology

Which of the following is a kind of ROM chip that contains permanently written data, instructions, or information that is recorded when the chip is manufactured?

A. L1 cache B. Flash memory C. firmware D. microcode

Computer Science & Information Technology