Lecture #13
- Announce
- Hour exam next Friday
- Review on Wednesday
- Begin to Read Chapter 4
Numerical Computation and the Study of Functions
- Writing Methods
- Informal synonyms
- Functions
- Procedures
- Subroutines
- Subprograms
- Have been invoking methods all along
- Also say call a method
- Arguments and Parameters
- Revisit Diamond Program
- Use Functions
- Dia(), and Mond()
- Still Fixed
DiaFuncts.java, DiaFuncts.html
- Slipped Parameters into ArrayStats Example.
- Subscript Range!!!
- In contrast to most languages, Java checks
- Run-time cost of checking
- Use Parameters to Increase Flexibility
- Use IntField to read in size
- Parameters change looping
DiaParms.java, DiaParms.html
- Methods that work on arrays
- Have array as one parameter
- Have array "size" as other parameter
- Functions:
- Set values
- Count values
- Sum values
- Locate/Search-for values