Zebra0.com

Section 31350: Due Sunday, April 28, 2024

You should complete the lessons Calculations and Functions and Random Numbers before doing this assignment.

Create an animation in Alice that does the following:
Two boys are practicing their soccer in the park. Repeat the following 3 times using procedures and functions where appropriate:

A loop is used to repeat the boys taking turns and counting and kicking:

  1. Boy1 makes kicking motion and says “1” (the first time)
  2. Ball is moved a random distance between half the distance between the two boys and the full distance between the boys:
    .

Please start with this:

Integer counter = 0;
while ( counter < 6 ) {
  counter = counter+1;
  // boy1 counts and kicks
  counter = counter+1;
  // boy2 counts and kicks
}

Make sure that 2 boys alternate counting to 6, then add the kicking which should be a biped procedure.

Don't do the next step until the previous step works correctly.

  1. Boy2 moves to the ball and makes a kicking motion and says “2” (the first time)
  2. Ball is moved a random distance between half the distance between the two boys and the entire distance between the two boys.
  3. Note that the distance between the boys has to be calculated before each kick.
  4. The boys will say back and forth, "1", "2", "3", "4" . . . until they reach "6". Use a variable for this, not a constant.
  5. If at the end, the boys are within 1 meter of each other, they both say "We won!" Otherwise they both say "We need more practice!"

Specifications:

Suggestions: This is a longer program than previous ones.

The following are requirements:

If any of these requirements are not met, the score will be 0.

Item

If the requirements are met, the grade is as follows:

ItemPoints
3
3
3
6
7
7
7
7
7
Possible points=50

C

If you do not receive a perfect score you may resubmit it as long as it is resubmitted within 3 days.
Assignment Index

This web site, and all pages therein, are the sole property and responsibility of Zebra0.com.
It is not endorsed, sponsored, or provided by or on behalf of Montgomery College.