Java Programming

 

       

 

Tuesday, October 22nd

 

Free Cloud Computing Workshop in Redwood City - Saturday, Nov. 2nd

Functions - make our programs more flexible
Variables - store data for our program
Parameters - values that are passed to procedures

Add the following Section 2-10 Vocabulary to your Java Definitions document:

- Symbols used to express a relationship between two expressions.
- To give a variable a name and to define the type of data the variable will contain.
- A place in memory where data of a specific type can be stored for later retrieval and use by your program.
- To assign a variable a value.
- Variables that store information about the object, such as color, width, height, and depth.

Begin Section 2: Lesson 10 - Variables slides.
Begin Section 2-10 Variables practice. Save the White Rabbit Project as 2-10 Random Hop. Save optional 1 activity as 2-10 Bunny Jazzercise.

Check with your instructor for special instructions before you begin Section 2-10 Variables project.
Steps for Section 2-10 Project.
Steps 1-8 - Random Head Shake
Steps 9-16 - Distance variable for the Swim procedure
Steps 17-25 - Adding a Parameter to the Swim procedure
Steps 26-28 - Using the Swim procedure for the Blue Tang fish
Steps 29-30 - Modifying Swim procedure and adding comments
Steps 30-47 - Refactoring your code by producing multiple procedures to reduce redundant code
Steps 30-36 - Creating the moveTail procedure
Steps 37-40 - Creating the moveFinsForward procedure
Steps 41-47 - Creating the moveFinsForward procedure
Steps 48-49 - Viewing the Java code
Steps 50-56 - Adding a loop
Steps 57-58 - Using your new procedures
Steps 59-61 - Adding Camera Movement
Steps 62-67 - Final modifications
Steps 68-70 - Adding Sound - stop after you add sound and demonstrate your program for teacher check.

Begin Section 2-10 Variables project. Save the fish as Fish_10.
Note the following change to this section:
Step 44. This one is slightly different because it requires a parameter so make a dist parameter here exactly as you did before in step 18. Drag the parameter name over the red label to complete the procedure.

Add the following Section 2-11 Vocabulary to your Java Definitions document:

- Allow the user to control one or more objects with the keyboard keys while the animation is running.
- Any action initiated by the user that is designed to influence the program’s execution during play.
- Listen for, and react to, a keyboard keystroke that you specify.
- The act of coding events to handle each procedure.
- Procedures in the Scene class that listen for keyboard input while the animation is running.

Begin Section 2: Lesson 11 - Variables slides.
Begin Section 2-11 Variables practice. Save the White Rabbit Project as 2-11 Rabbit Keyboard. Save optional 1 activity as 2-11 Submarine. Save optional 2 activity as 2-11 Snow Yak.

Begin Section 2-11 Variables project. Save the fish as Fish_10.

 

Homework

Add Class and Instance to your vocabulary list and fill in the definition of each.

 

What

In this lesson, you will learn how to:
• Use the IF control statement to effect execution of instructions
• Use the WHILE control statement to create a conditional loop for repetitive behavior

 

Why

When you create an animation or a game you may want an object to execute an action based upon a decision. You can use the IF control structure to help an object make a decision. “If you encounter a rock turn left, otherwise continue going forward”. You may also want objects in your animation to execute an action while
some condition is true. “While the boat moves left wave the person’s hand”. You can use the WHILE control structure to continuously loop an action while a condition is true.

 

How

By completing the slides, quiz and practice exercises.