誰能幫我看看這道 java題??

本帖於 2004-02-06 15:24:48 時間, 由普通用戶 old-cotton 編輯

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 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--

所有跟帖: 

回複:誰能幫我看看這道 java題?? -saqweewqeq- 給 saqweewqeq 發送悄悄話 (327 bytes) () 12/16/2003 postreply 06:17:00

sorry, some text get lost. -wqeasddsad- 給 wqeasddsad 發送悄悄話 (68 bytes) () 12/16/2003 postreply 06:21:00

請您先登陸,再發跟帖!