teylorjones2629 teylorjones2629
  • 20-10-2020
  • Computers and Technology
contestada

rray testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades

Respuesta :

MrRoyal
MrRoyal MrRoyal
  • 20-10-2020

Answer:

Replace

/* Your solution goes here */

with

sumExtra = 0;

for (i =0; i<NUM_VALS;i++){

if(testGrades[i]>100){

sumExtra = sumExtra - testGrades[i] + 100;

}

}

Explanation:

This line initializes sumExtra to 0

sumExtra = 0;

The following is a loop from 0 to 3

for (i =0; i<NUM_VALS;i++){

The following if condition checks if current array element is greater than 100

if(testGrades[i]>100)

{

This line calculates the extra credit

sumExtra = sumExtra - testGrades[i] + 100;

}

}

See attachment for complete question

Ver imagen MrRoyal
Answer Link

Otras preguntas

How many grams are in 2.4 moles of sulfur?
How many grams are in 11.9 moles of chromium?
I need the inequality answer.florence wants to buy onions and doesn't want to spend no more than $3. Can she buy 2.5 pounds ? They are 1.25 pound
what the british government wanted?
How many grams are in 11.9 moles of chromium?
find the volume of each sphere, both in terms of pi and to the nearest tenth. use 3.14 for pi
Anne has 24 more cards than Devi.  Anne finds that 3/5 of Devi's cards are equal to 1/2 of her cards.  How many cards does Anne have?
convert to fraction .34
I need the inequality answer.florence wants to buy onions and doesn't want to spend no more than $3. Can she buy 2.5 pounds ? They are 1.25 pound
find the volume of each sphere, both in terms of pi and to the nearest tenth. use 3.14 for pi