Make the shark chase program use a recursive method. Do this by modifying the World.chase method.
Create a world with two animal objects. Write a recursive method so that the animals count from 1 to 20 with one animal saying the odd numbers and the other animal the even numbers.
Suppose you have an array (ArrayVisualization) of 10 [...]
Entries Tagged as 'Lab'
Week 12 Lab
October 11th, 2009 · No Comments
Tags: Lab
Week 11 Lab
October 5th, 2009 · No Comments
Text book Extercise - Modify the WhackAMole game: “One possible modification to the WhackAMole game is to play it until the user has whacked all the moles. To make this adjustment, change the color of a mole in the list to red whenever it is whacked. Allow the mole to be raised only [...]
Tags: Lab
Week 11 and the long weekend
September 30th, 2009 · No Comments
Contrary to previous announcement in lectures, there will be lab exercises for week 11. I was not able to arrange that we skip next week’s lab and extend into week 13. So students who have labs on Monday, will have to do the exercises themselves and show their solutions to their tutors during the Wednesday [...]
Tags: Lab
Week 10 Lab
September 27th, 2009 · No Comments
Add a number of objects in a world and place some or all the objects in a list. Next, write a function that counts and returns the number of objects in your list. Use this function to make every object in the list say this number. For example, if your list has 4 objects then [...]
Tags: Lab
Week 9 Lab
September 20th, 2009 · No Comments
The following code features nested loops. How many times is the ‘inner loop’ executed? How long does the entire block of code take to execute? What would happen to execution time if the duration for the revolving overall Ferris wheel is changed from 12 seconds to 15 seconds? 10 seconds?
Give at least one significant difference [...]
Tags: Lab
Week 8 Lab
September 13th, 2009 · No Comments
Present your Assignment 2 storyboards.
Evaluate (give the value of) each of the following expressions:
3 < 5
true == false
10 >= 10
true and false
not ( both 3 < 5 and 10 >= 10)
Which of the expressions in question 2 (above) is considered a logical expression? Give a reason for your choice.
Exercise 6-10 Flying Between Two Trees. “Create a world [...]
Tags: Lab
Week 7 Lab
August 30th, 2009 · No Comments
Describe a significant difference between a movie animation and aninteractive animation in terms of control of flow.
In Alice’s drag and drop interface, relational operations are listed as part of the World’s built-in functions. Give a reason for making relational operations world-level, rather than class-level.
Why is a function required to have a return statement whereas a method does not?
Can [...]
Tags: Lab
Week 6 Lab
August 23rd, 2009 · No Comments
Exercises from the textbook:
Chapter 5 Ex 7 — Ninja motion
When you have completed this, change the ‘When key is typed’ events to ‘While key is pressed’ (by right clicking on the event and selecting ‘change to…’). Make the actions happen at the beginning of the keypress rather than at the end. Can you make the [...]
Tags: Lab
Week 5 Lab
August 15th, 2009 · No Comments
Do the following exercises from the textbook:
Chapter 3 Exercise 4 — Volleyball Jump
Chapter 3 Exercise 7 — Snowman to Stool
Chapter 4 Exercise 10 — Lock Combination
Tags: Lab
Week 4 Lab
August 8th, 2009 · No Comments
The main task of this week’s lab is to present your storyboards for assignment 1. We will be collecting copies of your storyboards, so please have paper versions available.
Remember that a storyboard has both pictures and text. You should have a short description of what each (active) object is doing in each scene.
Once everyone has [...]
Tags: Lab