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
Pamela finds that she is constantly spelling the word “color” as “colour” when she is typing. Even though this is how the word i
Oduvanchick [21]
She can hit always replace

7 0
2 years ago
Read 2 more answers
Which stage best represents the developing of documents that provides the basis for acquiring the resources and for developing a
UkoKoshka [18]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is the planning stage. Because the planning stage represents the development of documents that provide the basis for acquiring the resources and for developing the requirement document. at this stage, you plan about what you are going to develop and how to develop it. At this stage, you come out mainly with two documents i.e. project proposal and requirement document.

Other options are not correct because:

In the project management, after planning, you will start designing the product, and after designing you start developing the product, and at the implementation stage, you implement or deploy the product to the customer or to the client. The requirement document that is developed at the planning stage can be used in the later stages of the project.

7 0
3 years ago
Write a piece of code that constructs a jagged two-dimensional array of integers named jagged with five rows and an increasing n
Ksivusya [100]

Answer:

Explanation:

The following code is written in Java and it uses nested for loops to create the array elements and then the same for loops in order to print out the elements in a pyramid-like format as shown in the question. The output of the code can be seen in the attached image below.

class Brainly {

   public static void main(String[] args) {

       int jagged[][] = new int[5][];

       int element = 1;

       for(int i=0; i<5; i++){

           jagged[i] = new int[i+1]; // creating number of columns based on current value

           for(int x = 0; x < jagged[i].length; x++) {

               jagged[i][x] = element;

               element += 1;

           }

       }

       System.out.println("Jagged Array elements are: ");

       for ( int[] x : jagged) {

           for (int y : x) {

               System.out.print(y + " ");

           }

           System.out.println(' ');

       }

       }

   }

4 0
2 years ago
25 pts! If programmers cannot write an algorithm because the problem is too complex, which methodology can they use to reach an
Setler [38]

Answer:

D, most likely thats what I was taught .

3 0
3 years ago
User name ideas for ro blox? I'm changing mine and I dont know what I want. No numbers or underscores!
SpyIntel [72]
Lil.younging or 2k(your name)
8 0
2 years ago
Read 2 more answers
Other questions:
  • The item in this illustration that is highlighted is the _____. quick access tool bar view buttons status bar zoom control
    10·2 answers
  • Blogs differ from most other online text sources because they
    5·2 answers
  • Identify possible advantages and disadvantages of using automatic withdrawal to pay bills
    12·2 answers
  • Forms open in _______, which provides a user-friendly interface for entering data.
    11·1 answer
  • : Each individual data items of record is called a
    7·1 answer
  • The incompatibilities in speed between the various devices and the CPU make I/O synchronization difficult, especially if there a
    6·1 answer
  • PLEASE ANSWER FAST.one of the barriers for early "talkies" was the need to manually crank the projector and manually synchronize
    13·1 answer
  • I need help!!!! 1.04
    9·1 answer
  • What is the bandwidth for asymmetric digital subscriber line<br> (ADSL)?
    10·2 answers
  • Pls paanswer asap......​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!