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
vfiekz [6]
3 years ago
12

The code below is supposed to display the name and score for the student with the highest score one time before the program ends

. It is displaying Jim as the student with the highest score. It is displaying the highest score of 95. Unfortunately, Jim does not have a score of 95. Correct the following code:
Declare String students[SIZES] = {"Jen", "Jon", "Jan", "Joe", "Jim"}
Declare Integer scores[SIZES] = 70, 85, 72, 95, 90
Declare Integer index Declare Integer highest = scores[0]
Declare Integer highest Name = " " For index = 0
To SIZES //Assume that this translates to For (index = 0; index <= SIZES, index ++)
If scores[index] > highest then highest = scores[index]
End Of highestName = students[index]
End For Display "

The name of the student with the highest score is ", highest Name Display "The highest score is ", highest
Computers and Technology
1 answer:
Alona [7]3 years ago
7 0

Answer:

Modify

<em>If scores[index] > highest then highest = scores[index] </em>

<em>End Of highest</em>

<em>Name = students[index] </em>

<em>End For Display</em>

to

<em>If scores[index] > highest then highest = scores[index] </em>

<em>Name = students[index] </em>

<em>End Of highest</em>

<em>End For Display </em>

<em />

Explanation:

In the code, you posted the code segment that gets the name of the student with the highest score is outside the if condition that determines the highest.

To make correction, we only need to bring this code segment into the loop.

<em>See Answer</em>

You might be interested in
Prepare the truth table for the following boolean expressions: (A+B).(A+C).(B)
KiRa [710]

Answer:

July and December of last month were considered sedt Monday linng

6 0
3 years ago
The operating system is loaded into memory during the ____ process
Svet_ta [14]
Installation process

8 0
3 years ago
write a program that will create an array of 100 random integers in the range from [0,99] pass the array to a function, printarr
slava [35]

Answer:

In C++:

#include <cstdlib>  

#include <ctime>  

#include <iostream>

#include <bits/stdc++.h>

using namespace std;

void printarray(int array []){

for(int i=0; i<100; i++){         cout << array[i] << " ";    }

}

void sortarray(int array []){

sort(array, array + 100);

   printarray(array);

}

int main() {  

   int array[100];

   srand((unsigned)time(0));  

   for(int i=0; i<100; i++){  array[i] = (rand()%99);     }

   printarray(array);

   cout<<endl;

   sortarray(array);

   return 0;

}

Explanation:

<em>See attachment for program source file where comments are used for explanation purpose</em>

Download cpp
5 0
3 years ago
The part of the computer that contains the brain, or central processing unit, is also known as
g100num [7]
The CPU is also known as the system unit.
5 0
3 years ago
I need help plz
Alik [6]

Answer:

Try to restart your computer, if it doesn't work try looking up what to if anti-virus protection comes up randomly, without needing it.

Explanation:

Not Sure if you'll still get it even after restarting, but if it doesn't then hard shutdown the computer, So it could refresh it.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Index addressing is for traversing arrays.<br><br> True<br><br> False
    8·1 answer
  • On the Insert tab, select Table &gt; _______ to create a table from selected text.
    14·1 answer
  • Which statement correctly explains why televisions became less bulky?
    6·1 answer
  • What is a wiki farm?
    9·1 answer
  • You can add additional design elements to a picture by adding a color background, which is accomplished by using what Paint feat
    12·1 answer
  • In news writing, which is bigger , a topic or a angle
    10·1 answer
  • Explain the<br>4 ways<br><br>ways of arranging icons.<br><br>​
    6·1 answer
  • True or False: To create a function in python, you start with the keyword "def"
    5·2 answers
  • Here's something random idc
    8·2 answers
  • Buying a home security system is an example of protecting your home against________.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!