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.

Drawing Simple Shapes(contd.)

Drawing Ellipses

  • For our purposes here, we will define an ellipse as a basic oval shape.

  • The syntax of the ellipse function is:

    ellipse(x, y, w, h)
        x = x-coordinate at the centre of the ellipse
        y = y-coordinate at the centre of the ellipse
        w = width of the ellipse
        h = height of the ellipse
  • In the following picture, you can see an example of an ellipse.

Ellipse example from www.processing.org

  • Enter the following code in your open sketchbook:
    ellipse(85,50,20,60);
  • When you run the code, you should see the following ellipse whose centre is (85,50) and is 20 pixels wide and 90 high.

Drawing an ellipse

Drawing Circles

  • Using the ellipse() function, you can draw circles. Just set the width and height to the same number of pixels.

  • Try drawing a circle that has the coordinates (50,80) at its centre and has a diameter of 15 pixels.

  • Run the code. Did a circle appear?

Drawing a circle