1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
kolbaska11 [484]
3 years ago
11

Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full cre

dit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.
Computers and Technology
1 answer:
Tresset [83]3 years ago
5 0

Answer: The program in c++ language for the given scenario is given below.

#include <iostream>

using namespace std;

int main() {    

int sumExtra = 0, len;

int testGrades[len];

// this input determines the length of the array

cout<<"Enter the number of grades to be entered : ";

cin>>len;

 

for(int j=0; j<len; j++)

{

    cout<<endl<<"Enter grade "<<j+1;

    cin >> testGrades[j];

}

 

for(int i=0; i<len; i++)

{

    if(testGrades[i] > 100)

        sumExtra =  sumExtra + ( testGrades[i] - 100 );

    else

        continue;

}

cout<<endl<<"Sum of extra credit = " << sumExtra;

return 0;

}

Explanation:

Header files are imported for input/ output alongwith the namespace.

#include <iostream>

using namespace std;

All variables and array is declared of type integer.

int sumExtra = 0, len;

int testGrades[len];

User is prompted for the number of grades to be entered. This number is stored in variable len, which determines the length of the array, testGrades.

testGrades[len];

Using for loop, grades are entered for each index.

for(int j=0; j<len; j++)

{

     cout<<endl<<"Enter grade "<<j+1;

     cin >> testGrades[j];

}

Using another for loop and if-else statement, if the grade > 100, extra credit is added and sum is stored in the variable, sumExtra.

for(int i=0; i<len; i++)

{

     if(testGrades[i] > 100)

          sumExtra =  sumExtra + ( testGrades[i] - 100 );

     else

          continue;

}

This is followed by displaying the message with sum of the extra credit.

The main() function has the return type int. Hence, integer 0 is returned at the end of the program.

In the above, endl keyword is used to insert break line. The following message will be displayed on the new line. This is another alternative for the newline character, \n.

The given program does not implements a class since the logic is simple. Also, the question does not specify that the class and object should be used.

You might be interested in
Company A is setting up a network of mostly Windows machines. Which networking file system protocol would you recommend for maxi
maxonik [38]

Answer:

For maximum interoperability, NFSv4 is recommended.

Explanation:

When setting up a network of mostly windows machines, it is better to use NFSv4 because it includes performance improvements, mandates strong security, and a stateful protocol.

4 0
3 years ago
Is backing up computer files done on the hard drive?
8_murik_8 [283]
Yes but if the hard drive stops working you will lose your files so it's better to backup your files to a cloud like iCloud by Apple.
5 0
3 years ago
Read 2 more answers
HELP asap please... ​
Usimov [2.4K]

Answer:

I have absolutely no idea bruddah.

Explanation:

Soz!

8 0
3 years ago
A ________ is a very large general-purpose computer that is capable of performing very many functions as if these are done simul
Soloha48 [4]

Answer:

Mainframe Computer is capable of doing all the functions which are listed in question.

Explanation:

A mainframe is a very large general-purpose computer (usually costing millions of dollars) that is capable of performing very many simultaneous functions, supporting very many simultaneous users, and storing huge amounts of data. A microcomputer is the type of computer you use.

3 0
3 years ago
Structure for forloop?
solong [7]

Answer:

for ( initialization; condition;increment)

{

code goes here;

}

in python:

for i in list/range:

code with proper indentation

By initialization above we mean, like int i=0; etc.

By condition like i<10;

and by increment it means like i++, ++i or i+=1; etc

And in python, i can be an integer value if the range is mentioned, and it can be an item of a list if the list is used. We can also use an array, string and various other data structures in python. like we can have characters in a string and so on.

Explanation:

Please check the answer section.

8 0
3 years ago
Other questions:
  • After placing her insertion point after Grandma’s Kitchen, order the steps Danica needs to follow to insert and format the regis
    8·2 answers
  • PLZZZ HELP 30 POINTS!!
    14·1 answer
  • How come I haven't moved to the next rank even though I have all of the right things to move on?
    10·2 answers
  • Mobile app designers who work for themselves are often dubbed _____.
    10·1 answer
  • In the textbox below, write an email that you, as an administrative assistant at Techno Inc., would write to request information
    7·1 answer
  • Help me or I'll go insane I've 6x already I'm about to lose it!!!!
    11·2 answers
  • Which of the following statements best reflects the pros and cons of overtime potential for a line installer or repairer?
    15·1 answer
  • What is 4x+2x(-3-3) thanku
    11·2 answers
  • Please help with this coding question
    8·2 answers
  • In attempts to improve their contribution to the environment a company decides to adapt green computing. Which of these techniqu
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!