谢谢各位!!2003-12-16 08:07:00
Implement the frequency method.

public class Die
{ private final int MIN_FACES = 6;
private int numFaces; // number of sides on the die
private int faceValue; // current value showing on the die

public Die ()
{ numFaces = MIN_FACES;
faceValue = 1;
}

public Die (int faces)
{ if (faces < MIN_FACES)
numFaces = MIN_FACES;
else
numFaces = faces;
faceValue = 1;
}

public int roll ()
{ faceValue = (int) (Math.random() * numFaces) + 1;
return faceValue;
}
/**
Rolls the dice n times and determines how many times each face value
is rolled. It returns an array of size numFaces + 1 so that
the element at index 1 of the returned array is the number of times that
a 1 was rolled. The element at index 2 of the returned array is the
number of times that a 2 was rolled and so on and so forth.
*/
public int[] frequency(int n)
{ ??
}
public int getFaceValue ()
{ return faceValue;
}
}




--文学城www.wenxuecity.com--
check+this2003-12-17 00:08:00
回复:谁能帮我看看这道 java题??
tty2004-09-03 14:40:24
回复:回复:谁能帮我看看这道 java题??
tty2004-09-03 14:41:20
回复:回复:回复:谁能帮我看看这道 java题??