Course Info

#Programming Fundamentals 1

This is an introductory Programming module and assumes no prior knowledge of programming.

In this module, we will introduce you to the Java programming language through the Processing Development Environment (PDE) and then IntelliJ.

First, we will work through non-complex problems that will introduce you to the basic constructs of programming languages i.e. Sequence, Selection and Loops. You will also learn to use variables, different data types, manipulate the data, logical operators and methods. This will be done using processing.org

Then, using IntelliJ, we will progress to more complex problems that will briefly introduce you to object-oriented programming and data structures. You will do a deeper dive into both of these areas in the semester 2 module, Programming Fundamentals 2.

Challenges

  • For each exercise listed below, create a new sketch.

  • You may need to visit the Processing website for additional information.

Challenge 1 (static drawing)

Create a new sketch and, using two while loops, draw this image:

Image generated using for loops

When you have it working using while loops, convert the code to use for loops.

Challenge 2 (static drawing)

Create a new sketch and draw a chessboard (like the ones from exercise 1) on a 400x400 window using the rect() method instead of the line() method. You will need a nested for loop to do this.

Challenge 3 (static drawing)

Create a new sketch and using the code from Challenge Exercise 2, try to colour every subsequent square in a darker colour, as shown in the image below:

Chess Board with checkered pattern

Note: You will need to read up on the modulo (%) operator in order to do this exercise. This is quite a difficult exercise, so don’t worry if you can’t get it working.