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 11:40
Design a pos circuit that displays the letters a through j on a seven-segment indicator. the circuit has four inputs w, x, y, and z which represent the last 4 bits of the uppercase ascii code for the letter to be displayed. thus, if wxyz = 0001 then "a" will be displayed. (any answer with 22 or fewer gates and inverters, not counting any for the inputs, is acceptable)
Answers: 2
question
Computers and Technology, 23.06.2019 00:30
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
question
Computers and Technology, 23.06.2019 13:00
Donnie does not have powerpoint. which method would be best for elana to save and share her presentation as is? a pdf a doc an rtf a ppt
Answers: 3
question
Computers and Technology, 23.06.2019 15:00
Visually impaired individuals generally rely on the for navigation. thus, designers need to ensure that mouse-specific inputs, such as pointing, clicking, and hovering, can be done without a mouse.
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
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
English, 16.09.2020 18:01
question
English, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Chemistry, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Social Studies, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
English, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
question
Mathematics, 16.09.2020 18:01
Questions on the website: 13722367