CPS 1 - Spring, 1999 - Ramm 2/12/99 #13

Chapt 3. Numerical Computation and the Study of Functions

  • Setting it Up
    Declaration:
    double weights[];
    Definition:
    weights = new double[50];
    Or Combined:
    double weights[] = new double[50];

  • Subscript Range!!!

  • 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