Java Programming

 

     

 

Thursday, March 5th
Flex Schedule Today

 

Sign up for your Friday Flex Period

Today is the last day to get Project 4.4 checked off for full credit.

All programs can be created using a combination of the following - sequence, selection and repetition

Review of Loops - For Loop, While Loop and Do While Loop

LoopPractice Code

Loop Practice - create a program that asks the user for a word then tells the user how many characters are in that word and then prints each character on a separate line.
To find out how many charcters are in a string use the .length() method which returns the length of the word.
To find each character in a word you need a loop that selects each character one at a time using the .charAt(i) method.
Remember that strings are an array of characters with the first character is found at index 0.
Here is your starting code - complete the program so it works properly and then demonstrate for teacher check.


NOTE: Strings are always enclosed in "double quotes" while characters are enclosed with 'single quotes'.

Section 5 Lesson 2: Control Statements Vocabulary:
- A post-test loop that executes an unknown number of times until a condition is met, but always executes the first time through the loop.
- A pre-test loop that uses an iterator to keep track of how many times a loop will execute.
- A keyword used to skip over the remaining code in a loop and return program control to the beginning of the loop to execute again.
- A pre-test loop that executes an unknown number of times until a condition is met.
- A keyword used to terminate a loop from executing before the loop condition is met.

Complete Section 5 Lesson 2: Control Statements slides
Complete Section 5 Lesson 2: Control Statements  quiz and show your results to your instructor for teacher check
Complete work on the Section 5 Lesson 2: 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.

 

Homework

Install Eclipse on your home computer if you would like to be able to work on your java at home.

 

What

In this lesson, you will learn how to:
•Recognize the correct general form of a class
• Create an object of a class
• Describe object references
• Create methods that compile with no errors
• Return a value from a method
• Use parameters in a method

 

Why

Class templates are the foundation of the Java language. Understanding how to create a class with various methods will be essential to becoming a good Java programmer. Knowing how to instantiate an object and compare it to other objects is critical to learning to use and work with Java data types.

 

How

By completing the slides, quiz and practice exercises.