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
IPv6 is being developed in order to:
podryga [215]
B.) create more IP addresses

we’ve run out of all the possible addresses to be made with IPv4
3 0
3 years ago
Write a function named dice_eval that accepts two parameters representing numeric dice values and returns a string describing th
Zigmanuir [339]

Following are the "dice_eval" method code into python language.

Program Explanation:

  • Defining a method "dice_eval" that takes two variables "d1,d2" in its parametes.
  • Inside the method, multiple conditional statements were used that adds the parameter values and calculates its value which can be defined as follows:
  • In the if block, it adds the parameters and uses or gate that check its value that is equal to 7 or 11. so, it will return a string message that is 'Winner!'.  
  • In the elif block, it adds the parameters and uses or gate that check its value that is equal to 2 or 3 or 12. so, it will return a string message that is ' C r aps ! '.
  • In the else block, it uses a return keyword that adds parameter value and prints a string value.
  • Outside the method "d1,d2" is declared that inputs the value from the user-end, and passes the value into the method, and prints its value.

Program:

def dice_eval(d1, d2):#defining a method dice_eval that takes two parameters

if (d1+d2)==7 or (d1+d2)==11:#defining if block that adds parameter value and use or operator to check its value

return 'Winner!'#return string value

elif (d1+d2)==2 or (d1+d2)==3 or (d1+d2)==12:#defining elif block that adds parameter value and use or operator to check its value

return 'C r aps!'#return string value

else:#defining else block

return 'Point is '+str(d1+d2)#return string value with adding parameter

d1=int(input())#defining d1 that input value

d2=int(input())#defining d2 that input value

print(dice_eval(d1,d2))#calling method and print its return value

Output:

Please find the attached file

Please find the complete code in the attached file.

Learn more:

brainly.com/question/15011927

4 0
3 years ago
When creating an electronic slide presentation, Eliza should ensure that her presentation contains
kondor19780726 [428]

Answer: C) only one main idea on each slide.

Eliza needs to be able to use her electronic slide presentation to convey what the purpose of the presentation is. By providing one main idea on each slide, this would show the audience of Eliza exactly what she wants to convey to them. This would also help her audience get on board of what the whole idea of the presentation is.

8 0
3 years ago
A user is trying to log into windows on her notebook computer. she enters the correct password for her user account, but the sys
ASHA 777 [7]
Try restarting the PC. I have the same issue on Windows 10 sometimes generally its a network error because Windows 10 has a lot of internet required features... 
7 0
4 years ago
If you have two pennies, the probability of both coming up heads when flipped
aleksandrvk [35]
50% is the answer to your question
5 0
3 years ago
Read 2 more answers
Other questions:
  • WILL MARK BRAINLIEST IF ANSWERED ASAP
    10·1 answer
  • References are usally innocuous because they are the least personal and direct of the four reference types
    5·1 answer
  • How many unique ip addresses can be made in a fixed-length ip address system using 6 bits?
    8·1 answer
  • IF YOU ARE COMPUTER MASTER TELL ME WHICH SOFTWARE IS USED IN CALLIGRAPHY
    6·2 answers
  • Which of the following statements is correct? Group of answer choices An object of type Employee can call the setProjectName met
    11·1 answer
  • ________ is a publicly accessible website that allows users to add and edit interlinked web pages and make contributions from th
    8·2 answers
  • What would be the desired output of the home-security system
    8·1 answer
  • Which of the following actions would not reduce software piracy? reducing the cost of software. offering downloads of software.
    12·2 answers
  • You are working for a company that is responsible for determining the winner of a prestigious international event, Men’s Synchro
    5·1 answer
  • Can some help me on this"..... / ..--- ..--- / ..... / .---- ---.. / .---- ----. / ..... / ..... / .---- ....- / ..--- ----- / .
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!