Activity R7-1 *** Portfolio Activity *** 1. Declare and initialise a String array called names with the names of three of your classmates, or if you are an Online student, three of the names from one...


Activity R7-1 *** Portfolio Activity ***
1. Declare and initialise a String array called names with the names of three of your
classmates, or if you are an Online student, three of the names from one of the lectures.
2. Write the code that will play a sound "ouch.wav" 20 times, using a while loop.
3. Consider the following code:
int x = 3;
int i = 0;
while (i <>
{
x = x + 1;
i = i + 1;
}
What is the value of x after this code has executed?
Place your answers to this exercise in your portfolio document under the heading "Activity
R7-1".


Activity R8-1 *** Portfolio Activity ***
1. Declare and initialise a String array called names with the names of three of your
classmates, or if you are an Online student, three of the names from one of the lectures.
2. Write the Java/Greenfoot code (not in Greenfoot itself) that will loop through this array,
showing each of the names using the showText method, in a different location each time.
3. Write a loop that will add the even numbers from 2 to 2000.
4. Write a FOR loop that will display the numbers from 199 down to 100.
Place your answers to this exercise in your portfolio document under the heading "Activity
R8-1".


Activity R9-1
In your Autumn scenario, introduce a new class called Apple. Give it an Apple image. Write code in
the MyWorld class to place 12 apples at random locations.
Activity R9-2
Write code In your Block class to turn all apples by 90 degrees whenever the block hits the edge of
the world.
Activity R9-3
Create another class: Pear. Use a suitable image. Write code to place 8 pears into the world. Write
code in the Block class so that every time the block hits the edge all pears are moved 20 cells to
the right (in addition to turning the apples)

Oct 02, 2019ISY00245Southern Cross University
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here