Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. /*
  2. * To change this license header, choose License Headers in Project Properties.
  3. * To change this template file, choose Tools | Templates
  4. * and open the template in the editor.
  5. */
  6. package inbetweencardgamegui;
  7.  
  8. /**
  9. *
  10. * @author VIIXIII
  11. */
  12. public class Person {
  13. private String name;
  14. private double bankroll;
  15. private double bet;
  16. private boolean activePlayer;
  17. final double BUYING_AMOUNT = 20.00;
  18.  
  19. public Person(String name, double bankroll) {
  20. this.name = name;
  21. this.bankroll = bankroll - BUYING_AMOUNT;
  22. setActivePlayer(true);
  23. }
  24.  
  25. public String getName() {
  26. return name;
  27. }
  28. public double getBankroll() {
  29. return bankroll;
  30. }
  31.  
  32. public boolean isActivePlayer() {
  33. return activePlayer;
  34. }
  35.  
  36. public double getBet() {
  37. return bet;
  38. }
  39.  
  40. public void setBankroll(double earnings) {
  41.  
  42. this.bankroll = bankroll + earnings;
  43. if(bankroll <= 0)
  44. setActivePlayer(false);
  45. setBet(0.0);
  46. }
  47.  
  48. public void setActivePlayer(boolean activePlayer) {
  49. this.activePlayer = activePlayer;
  50. }
  51.  
  52. public void setBet(double bet) {
  53. if(bet < bankroll)
  54. this.bet = bet;
  55. else {
  56. System.out.println("All in!!!");
  57. this.bet = bankroll;
  58. }
  59. }
  60.  
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement