Presentation is loading. Please wait.

Presentation is loading. Please wait.

Welcome back! October 11, 2018.

Similar presentations


Presentation on theme: "Welcome back! October 11, 2018."— Presentation transcript:

1 Welcome back! October 11, 2018

2 https://goo.gl/qusxHV
Attendance!

3 Upcoming Opportunities
Mercer Island High School Coding Competition - 10/20 Please let us know if there are any events you think we should mention at the next meeting!

4 Review! Last week we learned about data types and print statements
Let’s refresh our knowledge on the topics covered last week: 4d8a0ac7a28d

5 Java Basics - Data Types
String: sequence of characters like “Hello world!” int: primitive data type with a binary value represented by an integer like 7 or 54 double: holds point values like 3.5 or 23.5 long: holds a 64-bit integer short: holds 16-bit integer boolean: holds either a true or false value

6 Java Basics - Print Statements
In Java, to print a line of code you need to use: System.out.println(); If you want to print without moving to the next line, use: System.out.print();

7 Review Practice Problem
Print a statement that states your name, age, and favorite animal If you get that, try to put it into a method and then print

8 Onto new material!!! Now that we have reviewed what we learned last week, and done a practice problem, let's move on to for loops and conditional statements!

9 Loops: For Loops For Loops are useful for many things:
Statement that specifies iteration Allows code to be executed repeatedly You can choose how many times you want the code to be repeated

10 for(int i = 0; i <10; i++) { }
For Loops - Syntax for(int i = 0; i <10; i++) { } Note: i++ doesn’t always have to be ++, it can be +=2 (which increments by 2 instead) or += any number to increment by that number Go through the different parts of a for loop

11 For Loops - Example for(int i = 0; i <10; i++) {
System.out.println(“I love computer science!”); } //this will print the statement “I love computer science!” ten times, each on a separate line

12 Loops - Different Types of Loops
While loops While something is true (i.e. x > 5) then the computer will continuously complete a task int x = 7 while(x > 5){ System.out.println(“I love to code!”); }

13 Conditionals

14 If Statements - Example
Int x = 5; if(x>3) { System.out.println(“YAY”); } The stuff highlighted is a conditional!

15 Practice Problems Loops:
Given the set of strings “apple”, “orange”, “banana”, use a loop to print all of the strings Extra challenge: can you print this backwards? Taking the set of strings “5”, “6”, “7”, “8”, “9”, print every other number Try printing this backwards as well

16 Practice Problems Conditionals:
Check if any random number is even with a conditional (Hint: %) Print a string if it has exactly 5 letters Write a program that accepts an age from the user and reports if they are eligible to vote (the age to vote is 18) Ask the user for two integers and print the greatest one among the two

17 More Advanced Problems
Write a program to check whether a entered character is lowercase ( a to z ) or uppercase ( A to Z ) Create any random set of numbers and test all the numbers to see if they’re equal (many ways to do this!)

18 Thank You! Next Meeting: 10/18! We hope to see you there!


Download ppt "Welcome back! October 11, 2018."

Similar presentations


Ads by Google