Structured Programming Revision and Java I/O Structured Programming Revision and Java I/O The first part of this set of notes is intended to revise topics that were covered in the Procedural Programming course and are assumed you are comfortable with in the Algorithms and Data Structures course. So please feel free to skip these notes unless you have found programming a bit difficult and want a rather gentler discussion than is contained in later notes. The second part of this set of notes says a little about the approach to input and output (I/O) taken in this course, which past experience suggests has confused some people. In this course I have decided to have programs that read and write directly to the console window from which you issue Linux commands. I have also decided to use only code that is provided directly as part of the Java system. This means that some fairly complicated looking code has to be provided to enable you to read and write things. You needn't worry about this code, it isn't part of the course that you have to understand it, or be able to remember it and reproduce it under exam conditions. If you like, just forget it and take it on trust that it works as stated. But I give a little more explanation of it below for anyone who is interested. The code presented in these revision notes can be found here. Distinguishing the important code from the input/output code Suppose we want to count the number of times a number occurs in a list of numbers. Note that we use the term "list" here just to mean an ordered sequence of numbers, and not in the specialist sense we use it in a later set of notes. Here is some code that will do what is required: import java.util.*; import java.io.*; class CountNumber1 // A program to read a list of numbers then read one number and // count the number of times it occurs in the list. { public static void main(String[] args) throws Exception { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Enter a list of numbers (all on one line):"); String line = in.readLine(); StringTokenizer toks = new StringTokenizer(line); int[] a = new int[toks.countTokens()]; for(int i=0; i