Introduction to Computer Programming

Table of Contents

Course outline and labs

  • Course outline
  • Labs

Introduction

  • How to use these notes
  • Introduction: computers, computer software and our approach
  • Computer software from the software creator's perspective
  • Programming languages for this course

Expressions

  • Mathematical introduction
  • Expressions in a programming language
  • Integers and operations on integers

Elementary algorithms

  • Giving things names
  • Step by step algorithms
  • Dealing with syntax errors

Defining your own functions

  • Defining your own functions
  • Functions and context

Defining functions by cases

  • Comparisons and boolean values
  • Cases
  • Functions that yield boolean results
  • Performing hand simulations with functions

Extending what you can do with equations using recursion

  • Equations and recursion
  • Checking recursive function definitions
  • Designing recursive function definitions

Characters, strings and types

  • Characters and strings
  • Types

Expressing algorithms using commands

  • Commands
  • Programs
  • Variables
  • Making decisions with statements

Defining functions using commands

  • Functions and commands
  • Procedures
  • Sanity checking functions

Loops

  • Loops and repetition
  • Loops for actions
  • Loops that accumulate results
  • Loops that search
  • Using flags
  • From hand simulations to loops

More on Loops

  • Infinite loops
  • Sanity checking loops
  • Debugging loops
  • The egoless programmer
  • Loops inside loops

Full programs

  • Creating and running Cinnameg programs
  • Getting input from the user

More on functions and recursion

  • Don't forget recursion
  • Function and procedure contracts
  • Top-down design

Interlude

  • A brief introduction to computer science



Introduction to Java

  • Introduction to Java
  • Expressions and types in Java
  • Variables in Java
  • Compound statements
  • If statements
  • While loops
  • A brief note on braces

Functions in Java

  • Functions
  • Functions Involving Loops
  • Recursion

Objects

  • Objects
  • Classes and primitive types
  • Characters and strings
  • Creating new objects

Complete programs

  • Procedures (void methods)
  • Complete Java programs

Handling errors: throwing and catching exceptions, null object references

  • Exception handling
  • Null object references

Input from the user and working with files

  • Reading from the keyboard
  • Reading and writing files

Arrays and for loops

  • Arrays
  • For loops
  • Arrays and methods

Searching and sorting arrays

  • Searching an array
  • Sorting an array