Java Programming

 

       

 

Monday, October 21st
Collaboration Day

 

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.


 

Homework

Think about the animation project you want to create for lesson 12.

 

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.