|
-
September 19th, 2008, 04:39 AM
#1
Stuck on assignment (due soon)
We're making a sort of yahtzee-type dice game.
There are two classes, Die, and Dice. Dice serves as a collection and means of manipulating multiple Die at a time.
The class for the dice is relatively simple and unimportant at the moment storing a 'size' value, a 'value' value, along with set, get, and roll methods.
In the 'Dice' Class, I add desired Die into an ArrayList, as I was told to.
Adding Die to this list is not difficult.
However, I am also to be able to add Die from a and existing 'Dice' object.
Here's what I've got so far.
...
public void add( Die dieToAdd )
{
diceArray.add( dieToAdd );
}
...
This part seems to work fine. (I've already declared the ArrayList a while back.)
Now here is where I get problems.
...
public void add( Dice diceToAdd )
{
Collections.copy(diceToAdd.diceArray,this.diceArray);
}
...
Why this does not work is beyond me. Please help. Much appreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|