November 24th, 2010, 09:13 AM
Ok guys I am having serious trouble finishing off the following program for an assignment Please help me out!
The aim is to simulate growing of trees in a forest, seen from above. The forest is an
initially empty square area.
There are four kinds of trees: beeches, birches, spruce, and a single magic tree. They
dier in the way they look and grow. Trees have a circular treetops, and the dierent
kinds have dierent colors. You may choose the colors; violet birches are ok. The
diameter of each tree increases by a constant each year; that is the diameter in year k is
the diameter in year k1 plus a number c. Beeches grow fastest, their diameter increases
by more than that of the other trees. Spruce grow slowest. The magic tree behaves
somewhat dierently. It grows most of the time but sometimes shrinks. Sometimes it
also changes its location. To find suitable values for the parameters is up to you.
The trees are initially at random positions, the magic tree is in the center of the forest.
On Campusnet you and four Java files. File ForestSimulation.java defines a class
which runs the simulation including all the graphic. File ConstAndUtil.java denes
some constants determining the forest size etc. It also contains some \utility" methods
that you might find helpful. File ForestDriver.java contains the main method where
a simulation is created and started. Finally there again is StdDraw.java which
is used to display the simulation.
What you have to do:
a) Look at the files ForestSimulation.java, ConstAndUtil.java, and ForestDriver.java
and understand what the programs do and how they interact.
b) Dene the missing classes to make the simulation run. Ensure that the program-
mer is forced to dene all methods necessary to run the simulation. This can be
done in two ways, both are appropriate.
c) Ensure that the trees behave as described.
The file ForestSimulation.java must not be changed, the other two files
Figure 1 shows an example and under the following link you can find a video showing
how such a simulation might run.
I have attached the parts necessary to finish this program . I am quite new at java programmering.
November 25th, 2010, 02:06 PM
Re: Help Please!!!!
Ok so this is your homework question what exactly are you stuck on.
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!