Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. package p5;
  2.  
  3. import java.util.Random;
  4.  
  5. /**
  6. * Created by Chrille on 2015-11-27.
  7. */
  8. public class SimpleDice implements Dice {
  9. private int sides;
  10.  
  11. public SimpleDice() {
  12. this(6);
  13. }
  14.  
  15. public SimpleDice(int sides){
  16. this.sides = sides;
  17. int value = 0;
  18. boolean inputOK = false;
  19. do {
  20. try {
  21. value = this.sides;
  22. inputOK = true; }
  23. catch( NegativeSidesException ) {}
  24. }
  25. while( inputOK == false );
  26. this.sides = sides;
  27. }
  28.  
  29. @Override
  30. public int throwDice() {
  31. // TODO Auto-generated method stub
  32. return 0;
  33. }
  34.  
  35. @Override
  36. public int getSides() {
  37. // TODO Auto-generated method stub
  38. return sides;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement