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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:50, williamsgregg5214
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer. b. don’t write your password down and leave it where others can find it. c. share your password with your friends. d.each time you visit a website, retain the cookies on your computer. e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
image
Computers and Technology, 23.06.2019 11:00, swelch2010
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
image
Computers and Technology, 23.06.2019 16:50, lukeakalucas
15: 28read the summary of "an indian's view of indian affairs."15 betterin "an indian's view of indian affairs," it is asserted that conflicts could be reduced if white americansunderstood native americans..pswhich of the following would make this summary more complete? eleo the fact that chief joseph believes the great spirit sees everythinthe fact that chief joseph was born in oregon and is thirty-eight years oldo the fact that chief joseph states that he speaks from the hearthehehethe fact that chief joseph of the nez percé tribe made this claimebell- ==feetle===-felsefe ==submitmark this and retum.=
Answers: 3
image
Computers and Technology, 23.06.2019 22:20, Izzyfizzy
Read “suburban homes construction project” at the end of chapters 8 and 9 (in the textbook) and then develop a wbs (work breakdown structure) in microsoft excel or in microsoft word (using tables)
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 in other subjects:

Konu
Mathematics, 22.06.2021 18:30
Konu
Mathematics, 22.06.2021 18:30