INF1B: Week 2: Arrays; Functions
Week Highlights
By the end of this week, you should understand:
- From lecture 3:
- What arrays are
- How to declare, create and initialise an array
- Shorthand syntax for initialising arrays
- What vector dot products are
- How to create two-dimensional arrays
- Matrix addition and multiplication
- What enhanced for loops are
- From lecture 4:
- Why functions are important
- Five benefits of splitting programs into functions
- The anatomy of a java function
- How functions control the flow of execution in a program
- How pass by value works
- What the signature of a java function is
- How breaking a complex process down into discrete steps can simplify coding
Lecture 3: Arrays
- Slides: 03-arrays.pdf
Lecture 3 ➡ Java Tutorial:
- Come back to Chapter 3. Language Basics, section on Variables and read subsection on Arrays.
Lecture 4: Functions
- Slides: 04-functions.pdf
Lecture 4 ➡ Java Tutorial:
- Read the first two sections of Chapter 2 Object-Oriented Programming Concepts carefully now, but stop at Inheritance.
- Read the first part of Chapter 4 Classes and Objects, stopping at Objects.
Tutorial:
No tutorial
Lab exercises
This week's lab exercises cover Boolean expressions, conditionals and loops. There are four warmup exercises, five core exercises, and three optional exercises for this week.
What should I be doing with the assignment?
Don't worry about it, the first assignment will be released next week.
License
Creative Commons - Attribution Share A Like