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 challenge listed below, create a new sketch.

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

Challenge 1

  • Draw a continuously bouncing ball.

  • For the moment, the xCoordiate should remain the same value i.e. the ball only bounces vertically, so it is only the yCoordiate that needs to change.

Challenge 2

  • Visit the Processing website and read up on the following keyEvents:

    • keyPressed (boolean variable used to determine if a key was pressed).
    • key (which stores a single alphanumeric character i.e. the most recently pressed key).
  • In a new sketch, draw a cirlce if the C key was pressed and a rectangle if any other key was pressed.

  • Test your code…is the keyboard input case sensitive? Can you enter a lower case c to draw a circle?

Any Key Pressed C Key Pressed

Challenge 3

  • In a new sketch, draw a vertical line that is the height of your display window.

  • This vertical line should start in the left most position of your display window and move right, pixel by pixel, until it reaches the right hand side of your display window.

  • Upon reaching the right hand side, the vertical line should reverse direction and return, pixel by pixel, to the left hand side of the display window.

  • As your vertical line is continually traversing the display window, your grayscale background should be varying very slightly in colour.