grade 11 ics3u (holtsoftturing) grade 12 - ics4u (java ......turing & java the grade 11’s...

14
Grade 11 – ICS3U (Holtsoft Turing) Grade 12 - ICS4U (Java Netbeans)

Upload: others

Post on 02-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

Grade 11 – ICS3U (Holtsoft Turing)

Grade 12 - ICS4U (Java Netbeans)

Page 2: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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”

Page 3: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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

Page 4: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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)

Page 5: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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.

Page 6: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

In Turing

Comments (continued)

Page 7: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

In Java

Comments (continued)

Page 8: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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.

Page 9: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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'.

Page 10: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

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)

Page 11: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

Creating variables in Turing:

Variables (continued)

Page 12: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

Creating variables in Java

Variables (continued)

Page 13: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

Arithmetic Operators In Turing, the following are some arithmetic operators

used:

Page 14: Grade 11 ICS3U (HoltsoftTuring) Grade 12 - ICS4U (Java ......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

In Java, the following are some arithmetic operators used:

Arithmetic Operators (continued)