grade 11 ics3u (holtsoftturing) grade 12 - ics4u (java ......turing & java the grade 11’s...
TRANSCRIPT
Grade 11 – ICS3U (Holtsoft Turing)
Grade 12 - ICS4U (Java Netbeans)
Turing & Java The grade 11’s (ICS3U) will be using Turing 4.1.1 and the
grade 12’s (ICS4U) will be using Java Netbeans this semester.
When a student saves a Turing program, it will have an extension “.t”, for example “exercise1.t”.
When a student saves a Java program, it will have an extension “.java” and the program name has to be the same name as the class name, for example “exercise.java”.
When a student compiles & runs a Turing program, there is no byte-code file.
When a student compiles & runs a Java program, there is a “.class” byte-code file. For example “exercise.class”
Turing & Java (continued) For Turing, when you start a program, you do not need to
create a class name. You can begin programming right away.
For Java, you have to first choose a class name before you begin.
The class name has to start with a capital letter, cannot have spaces in the name and cannot start with a number.
E.g. Exercise1 – acceptable class name
1Exercise – not an acceptable class name
exercise1 – not an acceptable class name
Below is what every Java program will have.
- The class name is Example1, and the program will be saved as Example1.java.
- the section starting with "public static void main“ is the start of our java program.
Turing & Java (continued)
Comments Some code is difficult to understand, even if you
understand the language it is written in. To that end, the designers of programming languages have allowed us to comment our code.
A comment is ignored by the program and is often used in the program to leave notes for the user or the reader to help make the program clearer.
In Turing, the % is used for a single line comment.
In Java, the // is used for a single line comment.
For both Turing and Java, the combination of /* and */ are used for multiline comments.
In Turing
Comments (continued)
In Java
Comments (continued)
Output To output in Turing, we use the keyword “put” to
display to a new window.
To output in Java, we use “System.out.println” (prints on the next line) or “System.out.print”
(prints on the same line)to display to a new window.
Variables Strings: "What is a string?" A string is a sequence of
characters. The characters can be ordinary things such as letters and numbers, or they can be wacky things found in the ASCII chart such as the plus-minus sign. A string is bounded by quotation marks, as in "Hello World!“ in both Turing & Java. A string can contain a maximum of 255 characters
Characters: A character is a single letter, number, or any wacky symbol that you can find in the ASCII chart. Characters are bound by quotation marks, as in in 'Q in both Turing & Java'.
Integers: We should all know what an integer is, given some fundamental math. Just to make sure, an integer is a whole number; it has no decimals; it is a fraction whose denominator is 1; it can be negative, zero, or positive.
Real Numbers: Real numbers can contain decimal places. Real numbers contain the realms of the positive, the negative, and zero.
Boolean: The boolean (named after George Boole) variable type contains only two alternatives: true or false.
Variables (continued)
Creating variables in Turing:
Variables (continued)
Creating variables in Java
Variables (continued)
Arithmetic Operators In Turing, the following are some arithmetic operators
used:
In Java, the following are some arithmetic operators used:
Arithmetic Operators (continued)