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
Papessa [141]
3 years ago
6

Given an int variable k, an int array incompletes that has been declared and initialized, an int variable nIncompletes that cont

ains the number of elements in the array, an int variable studentID that has been initialized, and an int variable numberOfIncompletes, Write code that counts the number of times the value of studentID appears in incompletes and assigns this value to numberOfIncompletes. You may use only k, incompletes, nIncompletes, studentID, and numberOfIncompletes.
Computers and Technology
1 answer:
Hoochie [10]3 years ago
5 0

Answer:

I will code in Javascript.

Preconditions:

The variables k, incompletes has been declared and initialized.

The variable nIncompletes contains the number of elements of incompletes.

The variable stududentID has been declared and initialized.

The variable numberOfIncompletes has been declared.

Script:

numberOfIncompletes = 0; <em>//initialize numberOfIncompletes</em>

for( k = 0; k < nIncompletes; k++) {

      if(incompletes[k] == studentID){ <em>//if the element of array is equal to studentID</em>

         numberOfIncompletes++; <em>//adds 1 to numberOfIncompletes</em>

      }

}

Explanation:

The script uses a for loop to go through the entire array incompletes, comparing the k variable with nIncompletes and adding 1 on each pass.

Then inside the for, uses an if statement to compare if the actual element is equal to studentID, if equal adds 1 numberOfIncompletes.

You might be interested in
You can easily view the ruler on a document by selecting the Show Ruler button located _____.
Ket [755]
In the “View” tab in the Ribbon.
7 0
3 years ago
Read 2 more answers
Forensic scientists generally photograph and sketch a computer and its components during their analysis? True or false
jenyasd209 [6]
This is considered true sir 
6 0
3 years ago
Read 2 more answers
Tab stops are useful when you want to?
Lelu [443]
Indentation and alignment are very noticeable on a printed page, so you will probably want to set the tab stops in your document precisely how you want them.


8 0
3 years ago
Write a function called cipher(phrase,shift)that accepts two parameters: a string phrase and an integer shift.The integer shift
Aleks [24]

Answer:

Following is given the code according to requirement.

The code is attached as an image so that the indentation is understood by the user. Comments are given inside the code where necessary.

The output of code is also attached as well  in end.

I hope it will help you!

Explanation:

7 0
3 years ago
Do you have to be in hard mode in terraria to make the timeless traverler vanity set
BabaBlast [244]
Answer: it can only be crafted in corruption world unless you create an artificial corruption biome.
4 0
3 years ago
Other questions:
  • 9. The best way to insert an existing Excel chart into a document is to A. use the Object command. B. click the Insert tab and c
    6·2 answers
  • Which of the following people choose a career path for the right reasons
    12·2 answers
  • _____ are types of changes that occur when text has been omitted from a document and must be inserted later.
    8·2 answers
  • In Modern operating system, the __ feature has dramatically improved user productivity.
    11·1 answer
  • Amy just added a 462 meter run of fiber optic cable to the network what should she do next?
    10·1 answer
  • A network administrator manages a network with 75 servers. At least twenty of those servers are approaching end of life but the
    8·1 answer
  • Rain forests clean the air by producing oxygen. Some rain forest plants have healing properties, and can be used as medicine. Ra
    12·1 answer
  • How can you reduce the Impact of Hacking? <br>pls help with this &lt;3​
    9·1 answer
  • What is pollution?
    14·2 answers
  • Which of the following statements about ip addresses is true?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!