Advertisement
Guest User

Untitled

a guest
Dec 5th, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package tom;
  2. import java.util.Random;
  3. public class bet {
  4. private String playerName;
  5. private int betAmount;
  6. private int roll;
  7.  
  8. private Random random = new Random();
  9. // This is how the dice randomisation is coded
  10.  
  11. public bet(String playerName, int betAmount)
  12. {
  13. this.playerName = playerName;
  14. this.betAmount = betAmount;
  15. this.roll = roll;
  16. }
  17.  
  18. public int rollDice() {
  19. int dice1 = random.nextInt(6);
  20. int dice2 = random.nextInt(6);
  21. roll = dice1+dice2;
  22. return roll;
  23. // This will randomly roll dice 1 and 2 and return the answer
  24. }
  25.  
  26. public int getBetAmount()
  27. {
  28. return betAmount;
  29. // This will get the amount of money left and return it
  30. }
  31. }
  32. // This is the end of the class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement