FIS IB Comp Sci 2014 yr 1 Blog

by , Frankfurt International School , Germany

IA Project Resources      IB Comp Sci Quick Start   

Looking at Haiku - 18 June 2013

Have a look at Haiku, especially project deadlines for next school year.

Continue Work on Prototype - 17 June 2013

Continue working on your prototype.
Ask questions and get help if you need it.

Prototype - 14 June 2013

Prototype Project

AFTER THE EXAMS each student will create a PROTOTYPE project.

The goal of the prototype is NOT to be a start to your real project,
but rather to get used to the process required, which is more than
just typing a Java program.  So it isn't absolutely necessary that
your choice for a problem for the prototype is your final choice
for the real project.  You will spend about 1 week on this task,
so if you throw it away you won't lose much work.  For this purpose,
it's best to choose a straightforward (or easy) problem that you
already understand well .... maybe a game of some sort.

Use this template which will help you do the right thing
in terms of creating and maintaining DOCUMENTATION parallel
to your programming work.

This prototype is due on 19 August.  It must include:
- DOCUMENTATION in each section of the template
- a
working Java program that solves at least some of the identified problem
- this will be submitted electronically - not printed on paper

We will work on this during class until the end of the year
(that is Tuesday 19 June).  You should ASK QUESTIONS
and GET HELP if you need it.  Make progress NOW -
don't assume that you can do it all in August.  That is

The prototype may be created with any tool(s) you choose -
NetBeans is recommended, but BlueJ is certainly adequate.

Some Useful Information - 12 June 2013

Final Exam
If you missed questions on the exam, especially programming questions,
you may wish to review them this summer.

Here is a good introductory video for NetBeans -

Pilot Project
We originally planned to spend a week on the pilot project
and finish it before the end of the year.  But due to various
class cancellations, that isn't going to fit into this year.
So we will plan on starting the pilot project from Friday 14 June
until Wed 19 June, and then finishing it the first week of
school in August.  Plan on working on this in class for
the next few class meetings.

Summer Plans - 10 June 2013

The class will meet in room 322 during period 2 today.

The teacher will distribute a DVD containing the NetBeans Java IDE and various study materials for the summer.

We will review the Final Exam results.

Homework :
If you use a personal laptop, bring it to class tomorrow with NetBeans installed.
You can either download a copy from or install it from the DVD.

End-of-year Exam Review - 28 May 2013

Sample Exam from 2011 - This year's final exam will be similar
to this one in structure, but do NOT assume that it will cover exactly
the same topics - we studied different things in 2011.  This example
just demonstrates the layout of the exam.


Here are topics from this year - you should definitely review these:

Computer Systems
Textbook Chapter 1
Computer Systems Notes  

Numbers in Computers
Intro to Binary 
Textbook Chapter 3
Floating Point and errors    
Binary Storage Examples  
Numbers Review Questions 

Reading about If command    
Password Check Program 
Type of Errors 

String Methods
String Examples 
Overdue Books  

Assembly Language 

Counselor Appointments Program   
Searching an Array Program 

Parallel Arrays Program 

-  Notes
sections 2.1-2.8 on this page
Student List Program   
-  Lockers Array Program   
Lockers Automation Notes 

-  Vector Lockers 

Information and Data
Information vs Data 
newest version of the Pisa program 
-   Text Files 
CIA Index ver 2  

Operating Systems
- Textbook Chapter 10
HowStuffWorks "How Operating Systems Work" (12 pages)  
list of OS questions     

Searching and Matching
How does Google search work? 
Methods for Comparing Strings  
String Comparisons Notes 
the Extra Spaces problem
Search Program   
-  Sequential Search, Dictionary Search, Binary Search 

Algorithm Efficiency  
-  Bubble sort, Insertion sort, Selection sort
Several Sorts with Java Source 
Sorting Efficiency Test Program  

Testing - test-cases, automated testing 

HL Students

- Compression and Encryption
- Embedded Processors -
- 2D Arrays  -  Kings
Download this Java class
- Linked-Lists
- Stacks and Queues  p 245-248 in Textbook


Java Programming
-  Declaring variables - int  float double String char
-  String methods    substring   charAt    .length()    equals   equalsIgnoreCase
-  if.. commands     &&     || 
-  loops   for   while
-  methods   public  void  return
-  declaring    arrays   Vectors   iterator
-  OOP   new   class   object   constructor

-  files   BufferedReader   FileReader    .readLine
-  (cast)   (int)   (double)


Important Words and Concepts

Variables    int    float    double    String  
Binary   hexadecimal   error   truncation   concatenation
CPU   processor   memory   RAM  
Bit  Byte   Kilobyte  Megabyte   Gigabyte   Terabyte
Arrays    lists    parallel arrays  length   index    
Vectors    iterator    next  
Exception   ArrayIndexOutOfBounds    NullPointer
OOP   object   class   .dot notation     constructor  
OS   multi-tasking   memory   processor  
MVC    Model-View-Control    GUI    controls

Tests and Quizzes (not complete)

int float quiz
num errors quiz

String quiz
 if quiz  

Nums Test SL
Nums Test HL

Assembly Language Test

Simple Array Test

Array of Objects Quiz

 Vector Quiz  

 Worst 10 Vector Quiz  

Vectors Test  

OS Quiz

Searching Test  

Sorting Test 

Make a Prototype - 24 May 2013


Prototype Project

AFTER THE EXAMS each student will create a PROTOTYPE project.
Today, make sure that you have CHOSEN A PROBLEM (topic) and
the teacher has approved it.  If you are unsure, discuss it with
the teacher today.

The goal of the prototype is NOT to be a start to your real project,
but rather get used to the process required, which is more than
just typing a Java program.  So it isn't absolutely necessary that
your choice for a problem for the prototype is your final choice
for the real project.  You will spend about 1 week on this task,
so if you throw it away you won't lose much work.  For this purpose,
it's best to choose a straightforward (or easy) problem that you
already understand well .... maybe a game of some sort.

Use this template which will help you do the right thing
in terms of creating and maintaining DOCUMENTATION parallel
to your programming work.


Final Exam

Next week we will spend 2 days reviewing for the final exam.
If you wish to start reviewing earlier, it's quite easy.

Next week, bring questions to class about things you would
like to have explained again.

Small Example Project - TicTacToe6x6 - 23 May 2013

Starting the Project - Suggested Topics

Your project is a much longer process than "just writing a program".

We will discuss these documents:

Starting Simple 

Big Tic Tac Toe Prototype

[HL] Recursive Thinking - 23 May 2013 (pd 1)

Here are some interesting web-links about the Travelling Salesman Problem:

TSP Applet
TSP in Wired
TSP Movie
Europe Simulation

Now we will investigate TIC TAC TOE,
specifically how to THINK AHEAD.
Here are some related notes :

   Trees Introduction

IA Project - 22 May 2013

HOMEWORK - read the first 3 pages in this document:
Starting the Project - Suggested Topics

and start thinking about what kind of a topic you might want to do.


The documents below will be useful next time:

Your project is a much longer process than "just writing a program".

We will discuss these documents:

  Starting Simple   Big Tic Tac Toe Prototype

Sorting Test - 17 May 2013

(1) Test on sorting algorithms

(2) Homework - read briefly through this sample Internal Assessment Project
                        Bring questions for discussion during our next class meeting.

Improving Bubble Sort Efficiency - 16 May 2013

Read these notes

Sorting Efficiency - 15 May 2013

Investigate and explain the efficiency of various sorting algorithms.
Use this program.

HOMEWORK: repeat the experiments we did in class
                      using YOUR OWN computer

 Do at least ONE long test -
     try something that takes 5 minutes or so

More Sorting - 13 May 2013

Sample sorting algorithms - some don't work:  Click here to download

Test Announcement - Test on Friday 17 about SORTING

Homework (before Wednesday)
- Fix the SelectionSort and the InsertionSort methods in the
   sample program

Sorting Practice - 8 May 2013 (pd 3)

Practice programming sorting algorithms -
Bubble Sort, Insertion Sort and Selection Sort


Traveling Salesman Continued - 8 May 2013 (HL pd 1)

We will continue discussing the Traveling Salesman Problem,
and look at the partial solutions programmed by
some of the students.

Sorting - 7 May 2013

Download this project

- Bubble Sort
- Several Sorts with Java Source

In the Computer Science Illuminated textbook, read p. 218-226

Binary Search - 3 May 2013

We will discuss yesterday's investigation,
then start programming a binary search.

Homework :

(1) Type in the BinarySearch method you received
      on paper from the teacher, and make it
      work correctly.  If you were absent, you can
      see the handout here:  BinSearch.gif

(2) In the Computer Science Illuminated textbook,
      read p.215-217. 

Search Efficiency Investigation - 2 May 2013

Search Efficiency Investigation

Programming the Dictionary Search - 26 Apr 2013

We have discussed the basic concepts of 3 search algorithms:

     - sequential search
     - binary search
     - dictionary search

Today we will discuss how to PROGRAM the dictionary search algorithm.
The basic concept is outlined in the following pseudocode:

Homework -

Write a Java method that performs the Dictionary Search algorithm,
searching for a word in the WORDS LIST used in previous programs.
Your method should also count the number of iterations (steps) required
until the method stops searching.  Then compare this methods speed
with a normal sequential search - make a table of 20 representative
words and record the number of iterations of sequential and dictionary
searches for each word.

Bring your results to class on Thursday 2 May, which is our next
class meeting.

Searching - 25 Apr 2013 - pd 3

We will discuss the 3 searching algorithms explained in these notes:

Quiz tomorrow about the 3 searching algorithms.

[HL] Traveling Salesman Problem - 25 Apr 2013 - pd 1

Read about the TSP at the end of these notes:

This is a very famous Computer Science problem.
So you can search in Google and find lots more information if you wish,
probably including some simulator programs that "solve" the problem.

Homework : Start with the TSP program that you received on paper.

Add any code that would be useful in solving the TSP problem, for example:

(1) find the 5 smallest numbers in the list miles array

(2) print out all the possible trips

(3) Given a trip in 5 steps ( AB, BD, CE, DC, DA )
     check that each city appears exactly twice

(4) Given a trip like :  ABDECA,
      add up the total miles in the trip.

Work on this for an hour or two.  You won't completely solve TSP
(but if you do, you'll be famous very quickly).  Just write some
pieces of program that might be useful in a TSP program.

Algorithm Efficiency - 24 Apr 2013

After finishing your test, read the following (also available on paper):

As you read, you should TAKE NOTES about anything that is unclear.
Plan on asking questions in class tomorrow.

Inserting in Alphabetical Order - 22 Apr 2013

Today we will learn how to INSERT a new word into an Array in alphabetical order.

Remember -  Test on Wednesday 24 Apr
Covering all the lessons from the past 2 weeks (Apr 9 onward)

More Searching - 19 Apr 2013

Here is a solution to the homework from yesterday -
using an ARRAY for searching in a list of words: 

Today's lecture -

Searching (in both a Vector and an Array) for many matching words,
returning the matches as a list (either a Vector or an Array as appropriate).

Searching in Lists - 18 Apr 2013

Here is an ALMOST solution to the Extra Spaces problem.
It contains exactly one mistake. 
You must study the "removeSpaces()" method until:

Searching in Lists

We must study the problem of searching in lists.
There are several related standard tasks:

  1. Write a loop that searches through a vector
    and finds one specific word
  2. Do #1 in an ARRAY.
  3. Search through a VECTOR, find many words that
    ALMOST match a target word, and return the matching
    words in a new VECTOR.
  4. Do #3 in an ARRAY, returning the matching words in a new ARRAY.
  5. Add a new word to a sorted array, placing the new word in the
  6. Use a BINARY SEARCH to search in a sorted array
    more quickly than a normal SEQUENTIAL SEARCH.


#1 - in the WordList program, find the method that does problem #1 above.

#2 - Make a new version of the WordList program,
       but it should use an ARRAY to do #2 above.

Future Classes

We will do problems #3 and #4 tomorrow in class.
On Friday we will do problem #5.
Next Monday we will do problem #6.

Test Announcement

We will have a TEST on Wednesday 24 April, period 1.

Automated Testing - 16 Apr 2013

Download this project archive -


Write a program that inputs a String, like:

  "   okay      dude  "

and the program removes any extra spaces, producing:

 "okay dude"

Try to start by writing the TEST CASES first,
before writing the program.  Code the test
cases like you saw in the previous program,
so the testing is automated.

Matching with Single Mistakes - 15 Apr 2013 pd 3

String Comparisons (includes HOMEWORK)

[HL] Levenshtein Distance - 15 Apr 2013 pd 1

The Levenshtein Distance between two Strings is based on the minimum number of edits required to change one String into the other.  Wikipedia has a straightforward explanation.

We will try to write a method that calculates this value.

Approximate String Matching - 11 Apr 2013

We will discuss students' ideas about how to check whether
two Strings are almost equal.

Searching Algorithms - 10 Apr 2013

We will do some experiments with a Java program
to implement some search algorithms.
Download this sample program :

You may find these links useful:
Methods for Comparing Strings
Fuzzy String Matching
Wikipedia Fuzzy String Matching (complex text, good links)

Homework :

(1) write a method for "endsWith()"
       to check something like
       "all the words ending with -ology"

(2) think about how human beings -
       and hence a computer program -
       can decide whether two words
       are "almost the same"
       For example :
           visibility  and  visibilty

Investigating Google Search - 9 Apr 2013

Continue investegating : How does Google search work?
Read the notes and do some experiments with Google.  

Answer the QUESTIONS in the notes (as many as you can)
and then do the Text Experiments.  You may find it useful
to work with a partner and help each other. 

Bring questions for discussion to class on Wednesday. 

Searching - 8 Apr 2013

How does Google search work?

For Example - 19-20 Mar 2013

We will make a list of examples where we see the results -
we will base our examples on this list of questions.
of the important ideas from our reading in the text-book.
The main ideas are summarized in the Ch 10 PowerPoint presentation.

We will have a short test (30 minutes) on Thursday 21 March,
about the vocabulary and examples from chapter 10.  The questions
will be mostly short answers - no long explanations.  Make sure
you understand the vocabulary.

Video about Operating Systems - 15 Mar 2013

Watch the first 40 minutes of this video: 

Take notes so you can ask questions in the next class.

If ou don't have headphones, you can show the vidoe
to the whole class on the teacher's computer.

Multi-tasking OS -  13 Mar 2013

We will do some experiments to examine the multi-tasking capabilities
of a Windows PC.  We will use this Java program:

Discussing Operating Systems - 11 Mar 2013

We will discuss the reading and experiments about Operating Systems.

More Operating Systems - 8 Mar 2013

HL Students - Task Manager and Desktop Experiments during class

SL and HL Students - Read Chapter 10 in Computer Science Illuminated
     HL students can do this at home, SL students can read during class

Homework - bring questions about Operating Systems to class on Monday

Operating Systems - 7 Mar 2013

Read about Operating Systems
Read these online notes about operating systems.

HowStuffWorks "How Operating Systems Work" (12 pages)

Bring your TEXT-BOOK to class tomorrow (Friday).

CIA Index Program ver 2 - 1 Mar 2013

CIA Index ver 2

Today's Printed Notes

CIA Index Program - 26 Feb 2013 pd 3

Test Announcement - Mid Term test on Tuesday 5 March
   The test will cover all topics since 20 Jan 2013

Today: Making a plan for the CIA Index Program

[HL] More Stacks and Queues - 26 Feb 2013 pd 1

We will write some programs to implement Stacks and Queues in a Vector
HOMEWORK - in Comp Sci Illuminated, read p 245-248(middle)

CIA Index Program - 15 Feb 2013

HOMEWORK - Good news!  Mr Mulkey found the time to upload the
CIA index program, so you don't need to type it in.  But you DO need to
improve it so that it ADDS UP THE RANKINGS for a country, so the
user doesn't need to write down results and add it up by hand.
Try to spend 30-60 minutes on this.  If you don't succeed , you'll
still learn something by trying.  Also, the notes below may be helpful.
Here is the archive containing the program and data files:


Notes About the CIA Index Program

An index is a measurement produced by collecting a small set of data for various entities.
For example, we can create a LIVABILITY INDEX by collecting 5 pieces of data for each country
from the CIA Factbook.  Here are data for China and the United States.  We can use the
TOTAL or the AVERAGE to compare the two countries.  Whether this is a GOOD or BAD indicator
of livability (quality of life) is a very subjective question.  And whether the data is actually
reliable or correct is a bit uncertain.  But an index value is still more useful than statements like:
"I LIKE China better"  or  "I heard that lots of people are leaving China".

Here are the index calculations:

 Data Sources (Factors)
United States Rankings
China Rankings
GDP per capita (2004)
Electric. Consumption (2042)
Labor Force (2095)
Life Expectancy (2102)
Investment (2185)
Total / Average
180  /  36
240 / 48

Assuming that higher rankings (smaller numbers) are better, the US has a better index
than China.  If we agree that the 5 factors shown provide sensible measurements
of livability, then the US provides a higher quality of life than China.  On the other hand,
we might want to include other factors in our index.  Also, we might think that
GDP is more important than Labor Force, and hence would not count these equally -
we would do a weighted average.

There is no "right way" to do an index.  Social scientists can argue for years about
which factors should be included and why.

Our problem as Computer Scientists is NOT to decide what is right and wrong,
but rather to write a computer program to AUTOMATE the production of the results.
Human beings should not waste their time reading large lists of data,
searching for results, writing down the results and then calculating totals.
That work is better left to computers, to automated systems.  The human beings
should spend their time making higher level decisions, like which factors should
be included in an index.

The following program does look up values automatically.  You can download
the program (together with all the data files) and try it out.  This is a BlueJ project,
so you should use BlueJ to run the program (load the "package" file).

CIA Factbook Initial Investigation - 13 Feb 2013

After finishing your quiz, read the notes about the CIA Factbook in this file:
Information vs Data

Then complete the Initial Investigation.  Be prepared to discuss your findings on Friday - that means that you should have results for your country, preferably results that are better than any other country.

Worst 10 Pisa Scores - 12 Feb 2013

Here is the newest version of the Pisa program,
including Worst10 methods - both iterative (SL) and Queue (HL).
    public void actions(Object source,String command)
        if(source == bWorst10)
        {  worst10(); }
        if(source == bWorst10q)
        {  worst10queue(); }
        if(source == bFindName)
            String name = input("Name of country?");

    public void worst10queue()
        // loop through the vector
        // at each entry,
        // copy that to the END of a second vector
        // if second vector.size > 10
        //    remove the first entry
        // That is a QUEUE  First In, First Out
        // at the end, worst 10 are in the second vector
        Vector<PisaScore> worst = new Vector();
        Iterator it = data.iterator();
            PisaScore ps = (PisaScore);
            if(worst.size() > 10)
            {  worst.remove(0); }
        for(int x=0; x < worst.size(); x=x+1)
            PisaScore ps = (PisaScore)worst.get(x);
            System.out.println(ps.nation + "  " + ps.score);
    public void worst10()
        // create an int called size = size of vector
        // create limit = size - 10
        // counting int
        // use an Iterator
        //   if count > limit then print it
        int size = data.size();
        int limit = size-10;
        int counting = 0;
        Iterator it = data.iterator();
            PisaScore ps = (PisaScore);
            if(counting >= limit)
                System.out.println(ps.nation + "  " + ps.score);
            counting = counting + 1;

Data File - 11 Feb 2013

Read these notes about Information vs Data.

Do #1-4 in the practice about PISA scores.

Last Day on Vector Lockers - 8 Feb 2013

We will write a few more methods today,
and there will be a Quiz on Monday 11 Feb.

You might find this helpful:

[pd 3] Continue Work on Lockers Program - 6 Feb 2013

How can we delete (remove) data from a Vector?

We need a few more BUTTONS and METHODS for our program.
For example:

Find the locker number for a name
Find the name for a locker number
Delete several lockers (whole HR)
List of lockers (with names) for HR
Alphabetical names
Sorted by locker number
Sort by HR then by name

Here is the latest copy of our Lockers program:

[HL pd 1] Operating System Resource Management - 6 Feb 2013

Introduction to STACKS (LIFO) and QUEUES (FIFO).
We will see how these can be IMPLEMENTED using a VECTOR our BASE CLASS.
We will discuss the Counselor program in

Saving Data and Loading It - 5 Feb 2013

We need to make our program SAVE the locker data into a FILE on the Hard-Disk.
We can use SERIALIZATION to do this.  Don't worry about the details just yet.
Type the following code into your VectorLockers program and get it running.
Be sure that the QUIT button always executes the FINISH method.

Here is the Serialization code - add this to

Notice that you must also change the Locker class so that it starts with:

public class Locker implements Serializable    

Type all the changes into your VectorLockers program, get it running properly,

More with Vector Lockers - 31 Jan 2013

Continue with this sample program:

1.   Create a new BUTTON and a METHOD to print out
      ALL of the locker assignements.

2.  Add the method for [Allocate HR] that allocates
      several lockers to a Homeroom Teacher.
      ASSUME that the lockers are not currently assigned

      HOMEWORK -
          add this code to the program
          then add lots of ERROR PREVENTION
    public void allocateHR()
        // showAllEmpties()
        // input HR teacher    Edwards
        // input first         501
        // input last locker   515
        //  loop from first to last
        //   make locker
        //   enter HR Teacher name into Locker
        //   add it to the vector
        String hr = input("Homeroom");   
        int first = inputInt("First");
        int last = inputInt("Last");
        for(int c = first; c <= last ; c++)
            Locker temp = new Locker();
            temp.homeroom = hr;
            temp.number = c;
            temp.student = "test" +c;  // testing

3.  Create a method to DELETE a locker assignment

4.  Create a better [Assign Student] method.
     It needs to implement the following "business logic":

Vector Lockers - 30 Jan 2013

A Vector is like a combination of a Linked-List and an Array.

Here is a new version of our Lockers database :

We will discuss Vectors in class, and you can do some
background reading in the handout from the teacher
Savitch ch 15, p 732-748).  The rest is for reference later.

You might also find this summary helpful:  Vectors How To

Automating Data Entry - 28 Jan 2013

Read the notes about Automation
and do the practice as described.

[HL] Starting Linked Lists - 25 Jan 2013

Linked List Notes

Continue Lockers with Objects - 24 Jan 2013

Lockers with Objects Notes

Today's Lecture :

   Design Pattern for a standard GUI program

Homework :

   Run it
   Test it
   Read it
   Change it
   Experiment with it
Quiz tomorrow about this program.

Lockers with Objects - 22  Jan 2013

Read these notes and do Version 2 of the Lockers program.

SNOW DAY - 21 Jan 2013

*** SNOW DAY ***

Watch these videos.  Write down WORDS that you don't understand -
technical words that sound important.  We will discuss them in class tomorrow.

We Are All Cyborgs     All Your Devices Can Be Hacked   10 Mindful Minutes   

Use some time today to make BACKUPS - extra copies
of anything that is important to you.

Finish the Lockers Program - 15 Jan 2013 (pd 3)

Reminder - test tomorrow Wed 16 Jan about GUI programming

Today - finish the Lockers program  Lockers Program

[HL] Kings with Buttons - 15 Jan 2013 (pd 1)

Read these notes

Lockers Database - 14 Jan 2013

Read these notes and do the exercises at the end.

Clicking in List Boxes - 10 Jan 2013

Lists for the Lunch Menu

Homework - Practice GUI programming - do any of the assignments
                    from today or the past 2 days

We will practice more on Monday and Tuesday and have
a test on Wednesday.

GUI with TextAreas - 9 Jan 2013

A TextArea is a box containing text, like this :

Read these notes and write some programs with TextFields.

Test Announcement - We will have a written test about GUI programming
                                   next week on Wednesday 16 Jan.

GUI Interfaces in Java - 8 Jan 2013

We will start writing Object Oriented Programs (OOP)
using GUI controls - Graphic User Interfaces.

Wisdom Program

Array of Objects - 13 Dec 2012 (pd 3)

Read these notes about a program to maintain a list of students
who check out early to go to the doctor or somewhere else.
It uses an Array of Objects to store the list of data.

[HL] Kings Game - 13 Dec 2012 (pd 1)

Download this Java class and read the notes at the end.

OOP Vocabulary - 12 Dec 2012

Discussed the homework reading sections 2.1-2.8 on this page.
Homework - read the same thing again, hoping that it makes
  more sense after today's lecture.

Java with OOP - 10 Dec 2012

Continue - we will continue discussing these notes about PARALLEL ARRAYS.

Online Java Notes
This is a web-site with clear and understandable notes about Java.
It includes a clear introduction to OOP (Object Oriented Programming). 

- Install BlueJ on your PC and check that it works correctly
- Run one of the programs from the web-site above,
   for example the PrimeList program on this page

Read sections 2.1-2.8 on this page.
Compile and run the TestCircle program.
Notice that you must copy the Circle class into BlueJ,
as well as the TestCircle class, and then you must
execute the main method in the TestCircle class.

Starting BlueJ - 7 Dec 2012

From now on, we will use BlueJ from .
You can visit their site and download the editor.
You should download the .jar version if you want to install it at school -
the Windows .msi file will be blocked by our network policy.
The .jar version should work on any platform (operating system)
including Mac OS X.

Here are some notes for getting started with BlueJ.


We will continue with these notes about PARALLEL ARRAYS.

Next week we will focus on Object Oriented Programming,
and BlueJ will help to make this easier to understand.

Arrays Test - 6 Dec 2012

1. Do your test and turn it in

2. Homework - read these notes, copy the program,
    run the program, and add a method that prints
    out the NAMES of all the items that cost under 2.00 .

More Practice with Arrays - 4 Dec 2012

Remember - Test on Thursday about Arrays

Here is an almost complete solution to yesterday's assignment.

We will discuss useful techniques for TRACING and DEBUGGING
programs containing loops and arrays.

Simple Array Practice - 3 Dec 2012

Do the problems in this document.

[HL] 2D Arrays - 3 Dec 2012

How do calendars work?
How can we store a calendar in Java?

How do board games work?
How can we store Tic-Tac-Toe or Mine Sweeper or KINGS in Java?

HL Homework -
Before next HL meeting, become a KINGS expert -
analyze the game and develop a winning STRATEGY.

More Arrays - 30 Nov 2012

(1) Finish the CD List Program problems

(2) Lots more practice with arrays
   - add up all the numbers in an array
   - find the largest number in an array
   - count how many numbers are greater than 10
   - find a number and delete it by changing it to zero
   - print an array in reverse order
   - REVERSE the order of numbers by exchanging [0] and [length-1],
      then exchanging [1] and [length-2] ... until the MIDDLE

   HOMEWORK - choose one of the problems above
         and write a Java program that solves it

We will have an ARRAY test on Thursday 6 Dec

Finish Counselor Appointments - 28 Nov 2012

(1) Finish the CANCEL method

(2) Questions from the reading (this chapter392-398)

(3) CD List Program

Arrays - 26 Nov 2012

Work on this sample program using arrays.

Homework -THINK about the following RESTRICTIONS
                    and how to PROGRAM a solution (automation)
- Need a minimum time
  - need a flexible way to assign LENGTH of appointment
  - use a loop to do this?

- Delete an appointment - fill it with "Cancelled" - need NULL
- MAYBE think of some other problem

Start reading this chapter
(p. 392 - 398)

Test and Starting Arrays - 20 Nov 2012

**  TEST about PEP/8 Assembly Language **

If you finish early, you may start your homework.


Read these notes.
Download the program, run it, try typing in appointments.
Observe any problems that occur. 
Bring questions to class on Monday.
You do NOT need to do all the practice problems.

Finishing the Digital Watch - 19 Nov 2012 (pd 3)

We need to finish the ALARM function for the digital watch program.

The following program works correctly up to 23:59,
but does not stop there.  It needs to be fixed.

             br start ; skip over the data area

secone: .WORD 0

secten: .WORD 5

minone: .WORD 7

minten: .WORD 5

hrone: .word 9

hrten: .word 1

start: deco hrten,d

       deco hrone,d

       charo ':',i

       deco minten,d

       deco minone,d

       charo ':',i

       deco secten,d

       deco secone,d

       charo 13,i

; now we add one second

       lda secone,d

       adda 10,i

       sta secone,d

       cpa 10,i

       brlt start

; secone has reached 10, need to reset to 0

       lda 0,i

       sta secone,d

; now increase secten by 1

       lda secten,d

       adda 1,i

       sta secten,d

       cpa 6,i

       brlt start

; secten is 6, need to set it back to 0

       lda 0,i

       sta secten,d

; now increase minutes by 1

       lda minone,d

       adda 1,i

       sta minone,d

       cpa 10,i

       brlt start

; minone is 10, need to set it back to 0

       lda 0,i

       sta minone,d

; now need to increase minten by 1

       lda minten,d

       adda 1,i

       sta minten,d

       cpa 6,i

       brlt start

; now we have arrived at 60 minutes

; need to set minutes back to 0 and add 1 to hours

       lda 0,i

       sta minten,d

       lda hrone,d

       adda 1,i

       sta hrone,d

       cpa 10,i

       brlt start

; now we have 10 in hrone - need to reset to 0

; then add 1 to hrten

       lda 0,i

       sta hrone,d

       lda hrten,d

       adda 1,i

       sta hrten,d

       cpa 2,i

       brle start



[HL] Character Based Addition - 19 Nov 2012 (pd 1)

Here is a sample PEP/8 assembler program that adds two numbers,
one digit at a time.   We will expand this program to do more digits,
maybe using a LOOP to make quite long numbers.

            br start

xones: .word 3

xtens: .word 2

xhuns: .word 1

xthos: .word 0

yones: .word 6

ytens: .word 5

yhuns: .word 4

ythos: .word 0

zones: .word 0

ztens: .word 0

zhuns: .word 0

zthos: .word 0

start: lda xones,d

       adda yones,d

       sta zones,d

       cpa 10,i

       brlt dotens

       suba 10,i

       sta zones,d

       lda xtens,d

       adda 1,i

       sta xtens,d

dotens: lda xtens,d

       adda ytens,d

       sta ztens,d

       cpa 10,i

       brlt dohuns

       suba 10,i

       sta ztens,d

       lda xhuns,d

       adda 1,i

       sta xhuns,d

dohuns: lda xhuns,d
       adda yhuns,d

       sta zhuns,d

print: lda zhuns,d

       sta 999,d

       deco 999,d

       lda ztens,d

       sta 999,d

       deco 999,d

       lda zones,d

       sta 999,d

       deco 999,d



Digital Watch - Assembly Language - 16 Nov 2012

We will create a digital watch control program in PEP/8 assembly language.
Read these notes.

Assembly Language - sec 6.4 - 13 Nov 2012

We will spend a week writing assembly language programs
using the PEP/8 emulator.  You are expected to learn and understand
everyting in section 6.4 (p. 166-174).

Test Announcement - test on Tue 20 Nov
The test will focus on assembly language, with a few connected
questions about compatibility between different platforms.

Today - continue with the sample programs in these notes .

Machine/Assembly Language - 12 Nov 2012

1.  Download the PEP/8 emulator here:
     (at FIS copy it from  V:\Mulkey Dave\Pep813Win)

2.  Study example 5.11

3.  Read these notes about PEP/8 Assembly language

Finish Language Comparisons - 8 Nov 2012

HOMEWORK - In your textbook, read p 151-174
(read quickly, details are not important)

More About High Level Languages - 7 Nov 2012 (pd 3)

We will discuss yesterday's experiments and some general issues
about syntax and PARSING of code.

[HL] How Smart Homes Word - 7 Nov 2012 (pd 1)

We will discuss this reading: How Smart Homes Work

Data Storage in Various Languages - 6 Nov 2012

1.  Visit the PSEUDOCODE site:
  (a) Run the program named Money Decisions.
  (b) Figure out the correct number of EUROS to make the program print "BINGO"
  (c) Add a nonsense line at the end of the program:
       Does this stop the program from running?
  (d) Add another nonsense line in the middle of the program.
       Does that stop the program from running?
  (e) Do you think this programming language INTERPRETTED or COMPILED?

2.  Visit this BASIC web-site: , then click on [Write Your Own].
  (a) Copy this program into the editor and run it.
EUROS = 75

print "Euros = " ; EUROS


print POUNDS ; " BP"

YEN = EUROS * 90

if YEN > 1000 then
   print "That is a lot of Yen"
end if

  (b) Find the LARGEST amount of EUROS that does NOT print "That is a lot of Yen".

  (c) Explain the purpose of the ; semicolon in this language.

  (d) Change one of the commands to introduce a SYNTAX ERROR.
       Run it and read the error message.

  (e) Is this language INTERPRETTED or COMPILED?

  (f) Is this language STRONGLY TYPED or WEAKLY TYPED?

3.  Translate the program from #2 above into Java and make it run correctly.

4.  Go back to PSEUDOCODE web-site:
     (a) Find an example program with a LOOP that is similar to FOR in Java.
     (b) Take one of your LOOP programs from last class (1 Nov) and translate it into PSEUDOCODE.

5.  Go back to the BASIC site :
     (a) Find an example program with a FOR loop in it.
     (b) Translate one of your LOOP programs from last time into BASIC.

6.  Decide which language has the SIMPLEST SYNTAX -
     Java, JavaScript, Pseudocode, or BASIC

Homework : Read p. 239-245 in the handout  (301-307 in your textbook)

Interpreters - JavaScript - 1 Nov 2012

  1. Get a copy of Kompozer - you can copy a Portable version for the PC from
    V:\Mulkey Dave\portableApps\KompozerPortable
    You need to copy the entire folder to the D: drive or some other local storage.
    Mac users and home PC users can download Kompozer from
    you can write JavaScript in this editor:
  2. Try typing this into the [Source] window (the non-bold stuff comes automatically from Kompozer):
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">
      <meta content="text/html; charset=ISO-8859-1"
        for(x = 1; x <= 10; x = x+1)
           document.write( x + " : " + x*x  + "<br>");

    Then [Save] and [Browse]

  3. In JavaScript, write loops for each of the following:

    (a) Count 1 , 3 , 5 , 7 , ... , 99
    (b) Count  10 , 20 , 30 ,..., 1000
    (c) Count   100, 99, 98, .... , 2, 1 , 0
    (d) Print a count-down
         Blast Off!
    (e)  Add up all the powers of 2 : 1 + 2 + 4 + 8 + ... + 2^20
    (f)  Add up the fractions :  1/2 + 1/4 + 1/8 + 1/16 + ... + 1/(2^20)

    Once you have done all these, write the same programs in Java (Processing),
    and check whether you get the same results.

More Loops - 31 Oct 2012

1. Group Quiz - guessing numbers

2. Some MATH programs (with loops)

3. Homework -
Begin reading sections 8.1-8.2 in the photocopy (chapter 9.2-9.3 in your book)

Loops and Efficiency - 30 Oct 2012

Number Guess and Algorithm Efficiency

More on Overdue Books - 25 Oct 2012 pd 3

Homework - create a method that accepts a month number (1-12) as a parameter,
and returns the number of days in that month - assume February has 28 days.
You can start like this:

void setup()
   int d = countDaysInMonthy(2);
   println( d );

int countDaysInMonth(int m)
   int answer = 0;
   if(m == 1){ answer = 31; }
   if(m == 2){ answer = 38; }
   // ....
   return answer;

[HL] Embedded Systems Vocabulary - 25 Oct 2012 pd 1

We will make a list of vocabulary words associated with control systems
that use embedded processors.

First we will watch a couple videos:
- Smart Vending Machine
- Billiard Robot
- Robot Car

Homework : read How Smart Homes Work (6 pages)

Overdue Books - Dates - 24 Oct 2012

We will spend two days working on this program:

Today, read the notes, download the program and make changes
as outlined in the practice section.

Even More Strings - 22 Oct 2012

Here is a solution for problem #2 from Friday:

void setup()
   String correct = "secret";
   String pw = input("Guess the password");

   { output("right");
   int letters = ____________;  // number of letters in password
   output("No, here's a hint: there are " + letters + " letters");
   pw = input("Guess again");
   { output("Right on the second try");
   output("Wrong again");
   char first = ________________;                  // first letter

   char last = ________________________________;   // last letter
   output("First letter = " + first);
   output("Last letter = " + last);
   pw = input("Third guess");

   {  output("Right on the third guess");
   output("This is your last try ... I'm tired of typing");

   output("It has the same letters as _____________");
                                              // scrambled letters
   pw = input("Fourth and final guess");

   { output("YES!! Finally");

   output("Give up? The secret word is 'secret'");  

public String input(String prompt)
{ return javax.swing.JOptionPane.showInputDialog(null,prompt); }

public void output(String message)
{  javax.swing.JOptionPane.showMessageDialog(null,message);  }

More Strings Practice - 19 Oct 2012

In these notes String Examples ,
do program #2.  Spend one class period
on this and no more than 30 minutes
at home.  Complete as much as you can
in that time and bring your program to class
on Monday.

You might want to read these notes : Savitch 1.3
These pages contain some useful examples.

HL Embedded Processor Presentations - 18 Oct 2012

String Quiz (5 minutes)

HL students will each give a 5 minute presentation about
a common embedded processor system, assigned last Monday.

More Strings - 16 Oct 2012

REMINDER - On Thursday, HL students will present a 5 minute explanation of their chosen topic (below).

We will discuss more String methods today.
We will have a 5 minute quiz on Thursday - about String methods.

Strings - 15 Oct 2012 (pd 3)

String Methods
String Examples
Homework - try out #3 (you need to copy INPUT and OUTPUT methods, too)
Try to do at least one of parts a,b,c.

Optional reading : Savitch 1.3 or Baldwin or Blue Pelican Lesson 3 & 17

[HL] Embedded Processors for Automation - 15 Oct 2012 (pd 1)

Background Reading : Automation

IB Syllabus 7.1.1 : Discuss a range of control systems.

A variety of control systems should be examined such as automatic
doors, heating systems (Evan) , taxi meters, elevators (Jonas),
washing machines (Tanmay), process control, device drivers,
domestic robots (Alex), GPS systems (Martin), traffic lights (Yasin)
`and other common devices.

Technical knowledge of specific systems is not expected but
students should be able to analyze a specified system.
IB Computer Science Course Guide p.39

We will write some sample control programs in Java.
In each case, consider the following questions:

  1. What input devices (sensors) must exist in the system?
  2. What output devices (actuators/transducers or motors) must exist?
  3. What processing must occur to make the system
    function correctly (input-processing-output)?
  4. What rules must be implemented as decisions
    in the embedded controller?

You might want to think about the processing first,
and then think about inputs and outputs.

Homework - Due Thursday 18 Oct

Each student should take one of the systems mentioned above
and answer the 4 questions, then present the answers to the class.
Prepare your presentation as homework, including some pictures -
recommend using Google Images.  And please include the
words "for example" frequently during your presentation.
Your presentation should last no more than 5 minutes.
Due Date : You will present your answers on Thursday 18 Oct.

ERRORS!!! - 12 Oct 2012

** Definition of ERROR **

== Types of Programming Errors ==

There are other kinds of errors in computer systems,
but these are the most important for programmers.

Error Handling - 10 Oct 2012

Elapsed Time

More Decisions - 9 Oct 2012

Password Check

For those who asked, here is an input method that keeps the password hidden:

public String inputPassword(String prompt)
    javax.swing.JPasswordField pwd = new javax.swing.JPasswordField(10); 
          null, pwd,"Enter Password",javax.swing.JOptionPane.OK_CANCEL_OPTION ) ;
    return new String(pwd.getPassword());

Logical Decisions in Java - 8 Oct 2012

Rolling Dice

Logical Thinking - 26 Sep 2012

We will be studying LOGICAL THINKING and the way that computers perform LOGICAL OPERATIONS.
We can start with a PUZZLE :

We will look at this sample program about Dates :  (open Data Validation)

Homework :  read about if..else if..else commands -

If Commands for Decisions - 25 Sep 2012 (pd 3)

Converting Units

[HL] Boolean Masks - 25 Sep 2012 (pd 1)

Masking Colors   or   CPU Emulator

Numbers Review Questions - 20 Sep 2012

Numbers Review Questions

Audio Data - 19 Sep 2012

We will use Audacity and FrHed to look at some sound data.
You can get a copy of Audacity from V:\Mulkey Dave\PortableApps -
copy the entire Audacity folder.  Or you can download it from

You should use .WAV files .  They are not compressed,
so the numbers are meaningful.  In Audacity, you can use the
GENERATE tools to create some sounds.  Then you must
EXPORT the result into a WAV file - saving does not work
as you expect.

Here are some very brief notes
about Audacity and .WAV file storage.

This is an interesting web-site about electronic music,
"data-bending" techniques, and some other sound stuff.

Solving Equations - 18 Sep 2012

Today - Discuss the Java programs from Friday.

Homework - Read section 3.4 about Audio storage
                    Bring headphones to class tomorrow.


*** Test Announcement ***
We will have a written test on Monday 24 Sep.
It will cover all of Chapter 3 in your textbook,
as well as all the Java programs and other
experiments we studied in the past few weeks.

Java Programming Practice - 14 Sep 2012

Do the programming practice exercises in the following two lessons:
Solve Math Equation , Car Trip

If you don't finish all that during class, spend 40 minutes at home to
finish as much as you can.  Don't spend more than 40 minutes.

Homework : Bring questions/comments about these programming tasks
     when you come to class on Tuesday.

Continue Hex Editor Practice - 13 Sep 2012 - pd 3

Hex Editor Practice (continue)

[HL] Compression and Encryption - 13 Sep 2012 - pd 1

We will investigate storage of floating point numbers,
and the common errors that occur due to rounding and truncation
of binary storage.  Here are some notes about binary storage
of primitive variable types:

For example, these calculations produce incorrect results:

Hex Editor Practice - 11 Sep 2012

Hex Editor Practice

Representing Data - 10 Sep 2012

Introductory Slideshow
Binary Storage Examples

Hex viewer/editor

Homework :

    HL students - read section 3.3 in your textbook (or the handout)
    SL students - read only p. 66-68 - the part about Compression is optional

Variables - 7 Sep 2012

Computers store numbers in memory locations, like boxes.
We can use variable names to identify these memory locations.
For this to work sensibly, we must declare the type of numbers
that will be stored in the memory location, because a memory
just contains bits, and they can be interpreted in a variety
of ways to produce a variety of different values. 
A Java program with variables looks like this:

   float x = 5 ;
  float y = (x-3)*(2x+4) ;
  println(x + " , " + y) ;

Read these notes and do the exercises and answer the questions.

Homework : Read "Binary Representations" at the end of section 3.1.
                     Also read section 3.5 .

Calculating with Doubles and Floats - 6 Sep 2012

Read these notes, do the exercises and answer the questions.

Calculation Errors - 4 Sep 2012

We will look at various causes of errors in computer calculations,
especially limits caused by finite storage space.

Numbers in Computers - 3 Sep 2012

Resources for studying numbers and data representation in computers.

Today :  First experience with Java programming - Java calculations.
             If you don't find Processing on your computer,
              you can download processing here.
             Processing is multi-platform - that means it runs
              the same on Windows, Mac and Linux.

Homework :  Read 3.2 in the handout

[HL] Secret Codes and Code Breakers - 3 Sep 2012 (pd 1)

Ceaser Cipher

Keyword Cipher

Code Breaking Video  

The Turing Game

Future Hardware Scenario - 27 Aug 2012

We will discuss the Future PCs scenario in these notes: 

Vocabulary from Ch 1 - 23 Aug 2012

We will discuss a few more ideas from chapter 1 today.

Afterward, finish organizing the online shared vocabulary list. 
You can finish adding content as homework.  Use web-sites,
ask questions and employ any other useful resources.

** Room Change **
On Monday and Tuesday next week (27-28 Aug) our class will
meet in Room 289.  There are a sufficient number of computers
available for our work. 

== Test Announcement ==
We will have a written test on Tuesday 28 Aug (pd 4).
You are permitted to use any available computers and any
notes that you bring with you, as well as any web-sites
that might be useful.  You may NOT communicate with other
people during the test - neither electronically nor in-real-life.
Make plans and prepare accordingly. The test will cover all
notes that and lectures from this year (except there will
be no questions for HL about robots).  Presumably any words
that are NOT listed on our vocabulary list are already well
understood and may appear on the test.

Study Questions for Chapter 1 in Computer Science Illuminated:

    Try to answer some of the questions at the end of the chapter.

(pd 3) Vocabulary from Ch 1 - 22 Aug 2012

We will make a list of vocabulary from the Chapter 1 reading.
Group (system) assignment -
  Make ONE list containing ALL the words that you all highlighted.
  Where possible, add EXAMPLES and EXPLANATIONS that contain
   the ESSENTIAL ELEMENTS of that term. 
  Use or any other reliable source

[HL pd 1] Robots and Mars Rovers - 22 Aug 2012

We will discuss the recent Mars Curiosity landing, as well as other robots.
Here are some useful links for the discussion:

Robots for Elderly People

All about robots

We want to answer the following questions:

Digital Devices, History and Future - 21 Aug 2012

We will discuss digital devices, history and future.
Hopefully you have all done the reading assignment - chapter 1 from Computer Science Illuminated.

Homework :
Read Chapter 1 of Computer Science Illuminated (handout) again.
Mark important vocabulary, especially words that you don't understand.
We will collect a comprehensive list tomorrow.

Faculty Smartphone Scenario - 17 Aug 2012

Here is an article to aid our discussion: 

Make a list of things you should rather NOT do with a Smarthphone (inefficient or difficult).
These are things for which the phone NOT EFFECTIVE.

Make a list of things that a Smartphone simply CANNOT do -
these should be tasks that a normal computer CAN do.
For example, neither is useful for hammering nails.  

First Day of Class - 16 Aug 2012

Computer Systems Notes - for class discussion today

Reading Assignment - before Tuesday 21 Aug,
read chapter 1 in Computer Science Illuminated.

Homework:  Watch this video
What is Computer Science?  Try watching this video.
How is that connected to our IB Computer Science class?