12345678910111213141516171819202122232425262728 |
- import java.math.*;
- import java.util.Map;
-
- /**
- * Write a description of class Dice here.
- *
- * @Mexi Liang
- * 06/08/2018
- */
- public class Dice
- {
- int numOfDice;
-
- public Dice(Integer n){
- numOfDice =n;
- }
-
- public Integer tossAndSum(){
- int sum =0;
- for (int i=1;i<=numOfDice;i++){
- sum = sum + (int)(Math.random()*6+1);
-
- }
- return sum;
- }
-
- }
|