Lab 11

Intro recursion video

Part 1:


Part 2: Create and explain two small recursive examples

  1. Calculate a recursive mathematical function: Triangle numbers, Fibonacci or Factorial calculation. If you're not sure where to start read the pre-lecture readings: ch7.1 (archived7.1), ch7.2, (archived7.2). You must show your TA or a CA how you can set breakpoints, step through the code and into your recursive function again and again using the step into debugger functionality to get full section achievement points today.
  2. Recursive graphics. Your program will use to recursion to create an recursive image (i.e no loops). For example, can you create something like this?

    Zen.drawImage(String imagefilename, int x, int y, int width, int height)

    is useful.

You'll find the Zen graphics class in MP2 and PairProgramming projects. Create your own new Java project and copy-paste the Zen class into your new project.

When creating a new project select "Use Project Root for source and class files"

For points today, demonstrate and explain your two programs to your TA. If you get stuck, ask other students for help.