Introduction to Computer Science
Lecture by lecture outline
-
We presented an example of an applet -
Example1Shalom.java,
containing a few simple drawing instructions.
-
We presented a simple application -
Example2Simple.java. We
discussed the following:
- Basic instructions.
- The four integer types - byte, short, int and long.
- The two real types - float and double.
- Variables and constants.
-
We covered the following:
- The "for" and "if" statements.
- Nested loops.
- Random numbers.
-
We presented an application -
Example3GCD.java - dealing with two
algorithms for calculating the greatest common divisor of integers.
The first algorithm is a naive one, stemming directly from the
definition, and the second is the Euclidean algorithm. The algorithms
are implemented by static functions residing at a separate class.
-
Additional primitive data types: char and boolean.
-
We covered the following:
- Strings.
- Arrays.
- Conversions.
- Introduction to recursion.
-
Simple examples of recursion:
-
Example4Pascal.java - calculating binomial coefficients
recursively.
- Example5Tangent.java
- computing recursively (approximately) the function tg at any
point (employing the formula for the tangent of a double angle, given
the tangent of the angle).
-
Example6KochSnowflake.java - an applet with a (finite
approximation of a) fractal known as Koch's Snowflake.
-
More examples of recursion:
-
We discussed the semantics of simple programs, and then gave an
introduction to objects via a simple example - Example10Customers.java .