subject

Each of the parts a. through c. below is preceded by a comment indicating what the code should do. There is a least one problem with each section of code and it fails to do what was intended. Show how to modify or rewrite the code the code so that it does work as intended. If there are multiple problems, correct each one. Assume that all variables used have already been declared. a. // INTENT: given an array arr of int values // set small equal to the smallest of the array values small = arr[0]; for (int j = 0; j < arr. length-1; j++) if (small b. // INTENT: compute the average of all n values in the integer array arr; 1/ compute the average as a double and store it in the double variable avg int sum = 0; int n = arr. length; for (int k = arr. length; k <= 0; k--) sum = sum + arr[k]; double avg = sum /n; c. //INTENT: the array b should have the values of array a in reverse order int[] a = {1,2,3,4,5); int[] b = new int[5]; for (int i=0; i<=a. length; i++) b[i-1] = a[a. length-i];

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 17:30
1. before plugging in a new device to a computer you should unplug all other devices turn off the computer turn on the computer 2. many of the maintenance tools for a computer can be found in the control panel under administrative tools display personalization
Answers: 1
question
Computers and Technology, 23.06.2019 19:30
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a,b] se pot scrie ca produs de două numere prime? “.
Answers: 3
question
Computers and Technology, 24.06.2019 17:00
The length of time that a slide appears before automatically advancing to the next slide can be set in the timing group under the transitions tab. transition to this slide group under the transitions tab. timing group in the master slide view. transition to this slide group in the master slide view.
Answers: 1
question
Computers and Technology, 24.06.2019 17:40
When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. this can be done by normalizing to values between 0 and 1, or throwing away outliers. for this program, adjust the values by subtracting the smallest value from all the values. the input begins with an integer indicating the number of integers that follow. ex: if the input is 5 30 50 10 70 65, the output is: 20 40 0 60 55
Answers: 1
You know the right answer?
Each of the parts a. through c. below is preceded by a comment indicating what the code should do. T...
Questions
question
Health, 08.02.2021 02:50
Questions on the website: 13722367