Levels Tought:
Elementary,Middle School,High School,College,University,PHD
Teaching Since: | Apr 2017 |
Last Sign in: | 4 Weeks Ago, 5 Days Ago |
Questions Answered: | 7559 |
Tutorials Posted: | 7341 |
BS,MBA, PHD
Adelphi University/Devry
Apr-2000 - Mar-2005
HOD ,Professor
Adelphi University
Sep-2007 - Apr-2017
Unit outcomes:
Course outcome(s) practiced in this unit:
IT111-2:Â Apply the programming constructs of parameters and arguments.
Problem:Â Grimm exercises.
The fantasy characters in Grimm stories want to change their public image (which is slovenly, overweight, and aggressive). They want to become more physically fit and friendly characters. With this in mind, Sam (Ogre) and Bill (Troll) are starting an exercise class for the Grimm community.
Create an animation where Sam and Bill demonstrate knee bend exercises.
Initial Scene:  In the Scene Editor, create an initial fantasy scene. Your scene does not have to look like the one shown, but can use any fantasy objects you choose to use. Be creative with the scene. However, it must have two fantasy characters, Sam (Ogre) and Bill (Troll) in the fantasy setting of your choice. You will find the Ogre class and the Troll class under the Biped class. Give the Ogre object you create the name Sam. Give the Troll object you create the name Bill. Once you have created your scene, save the world as GrimmExercise.
Algorithm:
Of course, the Ogre and Troll classes do not have a knee bend procedural method. Therefore, you will need to write your own kneeBend procedure for each class.
Decomposition: Start by decomposing the procedure into simple steps. Below is an example procedural decomposition, using the Ogre’s joint structure. This procedure is a bit more complicated than you might expect. This is because a knee bend is actually a combination of bending both knees and lifting both arms upward (for balance). In this example, the numbers specifying the amount of rotation for the joints is arbitrary. You may wish to experiment with other amounts to obtain a more realistic animation of a knee bend, although these amounts work fairly well.
Implementation: Create and test the program code for a kneeBend procedure in the Ogre class. HINT: This procedure has two basic parts – one part to bend the knees and one part to straighten up. You can take advantage of this in creating the code. Create the first do together code block for the downward knee bend and then hold down the ctrl key (alt on Mac) to drag a copy below to make the second code block. Then, in the second code block, reverse the motion (for example, change move down to move up) for each statement.
Be sure to document and save your project before going on.
Using the clipboard to duplicate code
At this point in the project code, Sam (an instance of the Ogre class) has a kneeBend procedure. However, Bill (an instance of the Troll class) does not. One way to create a kneeBend procedure for the Troll class is to use the clipboard to copy and paste the code from the Ogre class to the Troll class. The screen grabs on the next page illustrate the process of using the clipboard for copy and paste of an entire procedure.
(Step 1). In the procedure, if you have not already done so, add a Do in order block to enclose the two Do together blocks. Then drag the entire Do in order block to the clipboard.
(Step 2). Create a new kneeBend procedure in the Troll class.
(Step 3). Paste the code for the kneeBend procedure into the Troll class kneeBend editor tab by dragging the code out of the clipboard onto the new procedure tab.
Now that both Ogre and Troll classes have a kneeBend procedure, complete the program as described in the algorithm at the beginning of this assignment.
Be sure to save the GrimmExercise project as GrimmExercise.a3p and submit this as Part 1 of this assignment to DropBox.
Part 2
Problem:Â Adding a Parameter
The Grimm community has joined for a group exercise session. Use the world created in Part 1 and add more biped objects (of your choice). All objects (other than props) should be instances of classes belonging to the Biped class hierarchy.
Part 2 of the assignment is to write a program in which the Scene class has procedures for a knee bend exercise (In other words, it is a world level method that can be used by every biped object in the animation). This procedure should have a parameter that specifies the object that will perform the action defined in the procedure.
Test your project by writing statements in myFirstMethod  that have the objects each perform a knee bend one after the other, and then perform a knee bend (all at the same time.)
Do not forget to effectively use your clipboard here!
Submit Part 2 of the Assignment as GrimmExerciseFinal.a3p
Requirements:
IT -----------111----------- Un-----------it -----------3 A-----------ssi-----------gnm-----------ent-----------