12345678910111213141516171819202122 |
-
- public class Dice
- {
- int numberOfDice;
- public Dice(){
- numberOfDice = 1;
- }
-
- public Dice(int numberOfDice){
- this.numberOfDice = numberOfDice;
- }
-
- public int tossSum(){
- int currentTotal = 0;
- for(int i = 0; i <numberOfDice; i++){
- currentTotal += (int)Math.ceil(Math.random()*6);
- }
- return currentTotal;
- }
-
- }
|