CPS 1 - Spring, 1998 - Ramm 2/13 #13
- Announce
- Test in One Week
- Review Sessions...
Chapt 3. Numerical Computation and the Study of Functions
- Setting up Arrays
- Declaration:
-
double weights[];
- Definition:
-
weights = new double[50];
- Or Combined:
-
double weights[] = new double[50];
- Subscript Range!!!
- Dangers of scribbling over memeory
- Java checks; some langauges don't
- Tradeoffs
- Simple Examples: Develop Algorithms in Class
- Maximum Example (code fragment)
-
tallest = 0;
-
k = 0;
-
while (k < attending)
-
{
-
if (height[k] > tallest)
-
{
-
tallest = height[k];
-
}
-
k = k + 1;
-
}
- Applet Array Example
Hotel.java,
Hotel.html
- Expanding the Hotel Example