This collection of sample programs is not a Java textbook - there
are plenty of those available from other authors. This set
of programs proceeds from very basic calculation skills, through
if... commands and loops, through arrays and vectors, ending with
some algorithm efficiency problems.
The intention of the programs is to illustrate the programming
skills required by the new IB Computer Science syllabus for exams
in 2014. These are the programming skills required in
section 4 of the syllabus. If students understand these
sample programs and they have enough skills that they could write
similar algorithms in pseudocode
during the exam, they should be well prepared. These samples
may provide ample practice, but a bit of expansion should develop
their core programming skills adequately. At least that is
the intention.
Processing
The programs are all written for Processing
- a free Java development tool. Processing provides numerous
small simplifications, like typing just println instead of System.out.println. It should be relatively
easy to adapt these programs into a standard Java development
environment. But the intention was to make this as simple as
possible, since the core programming skills are not intended for
software development, but rather for reading and discussing
relatively short algorithms in an exam situation. Keep in
mind that Paper 1 exams will actually use pseudocode, not
Java. But these sample programs use techniques that are
consistent with what students will encounter in pseudocode.
After starting with Processing, students can easily switch to a
more standard tool for studying the OOP Option. OR they can
simply continue with Processing, which is sufficiently standard
and supports all the required concepts and techniques as required
in the JETS specification.
Standard Java
I'm a big fan of Processing, but some people might not like
it. If you want to use the sample programs in a standard
Java environment, here are some hints for conversion.
Conversion to standard Java is a relatively simple task.
Processing Command |
Standard Java Commands |
automatic in Processing
some other imports are automatic in Processing |
import
java.io.*; // for files import java.util.*; // for Vector |
Processing does all this automatically. |
public
class Name {public static void main(String[] args) { new Name(); } ..... } |
void setup() | public Name() // the constructor |
println("hello"); | System.out.println("hello"); |
int("123 EU"); |
Integer.parseInt("123
EU"); |
float("123.45"); |
Float.parseFloat("123.45"); |
PrintWriter file = createWriter( "prices.dat" ); |
try{ PrintWriter = new PrintWriter( new FileWriter("prices.dat"); ... } catch(IOException ex) { ... } |