CMPSC 121 Chapter Notes -Method Stub

70 views2 pages
School
Course
Professor

Document Summary

R 6. 5: public static void main(string[] args) { // todo auto-generated method stub double[] arr = new double[] { -0. 11112, -0. 07654, -0. 03902, 0. 0, // find out maximum value for (int i = 0; i < arr. length; i++) { if (arr[i] > max) { max = arr[i]; A: the program initializes an array of ten integers, but doesn"t have a named constant like (int[] values = new int [length};) B: the program doesn"t declare how big the array will be based off the int values. Also, it says that i < values. length , but that will create a run time error because the index needs to be greater than 0 and the array length less than 0. // todo auto-generated method stub int[] lottery_numbers new int [49] { int i; for (i=0; i < lottery_numbers. length; i++){ lottery_numbers[i] = i + 1;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions