Intro to AI Presentation
AI Bootcamp this summer
Cybersecurity Summer Camp - Free
Site of the Day www.code.org
Free On-Line Courses - can't get enough coding? Try one of these courses.
All programs can be broken down into these three components:
Sequence
Selection
Repetition
Introduction to Loops - postponed until tomorrow
For Loop
While Loop
Do While Loop
Common mistakes - failure to increment your counter - results in an infinite loop.
Failure to meet the exit condition - infinite loop.
Begin Section 5 Lesson 2: Control Statements slides
Begin Section 5 Lesson 2: Control Statements quiz and show your results to your instructor for teacher check
Begin work on the Section 5 Lesson 2: Control Statements practice.
Section 5.2 Coding - show your programs to your instructor for teacher check:
1.
Message Decoder
4. Anagram
Relational operators, logical operators &&, ||, !
The ternary operator (?:) - an if else short cut
int x = c > 9 ? 6 : 7; //If c is greater than 9, x is 6; else x is 7
Intro to Arrays
Copy and paste the following script into a class called ArrayPracticeScript. Add comments to the code during your class discussion.
NOTE: Strings are always enclosed in "double quotes" while characters are enclosed with 'single quotes'.
Complete Section 5 Lesson 2: Using Program Control Statements slides
Complete Section 5 Lesson 2: Using Program Control Statements quiz and show your results to your instructor for teacher check
Complete work on the Section 5 Lesson 2: Using Program Control Statements practice on school loop.
Section 5.2 Coding - show your programs to your instructor for teacher check:
1.
Message Decoder - you must use only one println to print out the decoded message.
4. Anagram - hint sampleString.indexOf( characterX ) will return a -1 if the characterX is NOT found in sampelString. You will need to use a loop to pull out each character in the first word and see if it is in the second word.
Introduction to Arrays!
Arrays - objects that store a collection of primitives or objects of the same type.
The elements of an array are accessed by the index value of that element. The starting index is 0.
Declaring an Array[]
String[] teamMembers = new String[12];
OR
String teamMembers[] = new String[12];
OR
String[] teamMembers;
teamMembers = new String[12];
Initializing an Array
Declare and initialize in the same statement
String[] teamMembers = {Dodge, Newman, Henderson, Canning, Stein}; // array size determined by the number of values provided. This method is used when you already know the contents of the array.
OR
String[] teamMembers = new String[5]; // declare the array
teamMembers[0] = "Dodge"; // initialize the array elements
teamMembers[1] = "Newman";
teamMembers[2] = "Henderson";
teamMembers[3] = "Canning";
teamMembers[4] = "Stein";
Iterate through an Array
for (int index = 0; index < teamMembers.length; index++)
System.out.println(teamMembers[index]);
Begin Section 6 Lesson 1: Using Arrays slides
Complete Section 6 Lesson 1: Using Arrays quiz and show your results for teacher check
Complete work on the Section 6 Lesson 1: Using Arrays practice on school loop.