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.