The following code uses a for loop to sum the elements of an array. Find the error(s) in the following code:
```
1 public void sumArray()
2 {
3 int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
4
5 for ( int counter = 0; counter <= numbers.size; counter++ )
6 {
7 int sum += numbers[ counter ];
8 }
9 } // end method sumArray
```
The expression numbers.size should be numbers.length. Variable sum should be declared outside of the loop.
```
1 public void sumArray()
2 {
3 int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
4
5 int sum = 0;
6
7 for ( int counter = 0; counter <= numbers.length; counter++ )
8 {
9 sum += numbers[ counter ];
10 }
11 } // end method sumArray
```
You might also like to view...
How many bytes of memory are used in MS Visual C++ for the datatype float ?
A. 1 B. 4 C. 8 D. 2
Consider the following set of requirements for a UNIVERSITY database that is used to keep track of students' transcripts. This is similar but not identical to the database shown in Figure 1.2:
(a) The university keeps track of each student's name, student number, social security number, current address and phone, permanent address and phone, birthdate, sex, class (freshman, sophomore, ..., graduate), major department, minor department (if any), and degree program (B.A., B.S., ..., Ph.D.). Some user applications need to refer to the city, state, and zip of the student's permanent address, and to the student's last name. Both social security number and student number have unique values for each student. (b) Each department is described by a name, department code, office number, office phone, and college. Both name and code have unique values for each department. (c) Each course has a course name, description, course number, number of semester hours, level, and offering department. The value of course number is unique for each course. (d) Each section has an instructor, semester, year, course, and section number. The section number distinguishes different sections of the same course that are taught during the same semester/year; its values are 1, 2, 3, ..., up to the number of sections taught during each semester. (e) A grade report has a student, section, letter grade, and numeric grade (0, 1, 2, 3, 4 for F, D, C, B, A, respectively). Design an ER schema for this application, and draw an ER diagram for that schema. Specify key attributes of each entity type and structural constraints on each relationship type. Note any unspecified requirements, and make appropriate assumptions to make the specification complete.
You can manually add a table to a PowerPoint slide by using the ________ Table feature
Fill in the blank(s) with correct word
The Notes pane is an area of the ________ that displays below the ________
A) Presenter view; Comments pane B) Presenter view; Slide pane C) Normal view; Status bar D) Normal view; Slide pane