Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. //This class defines a player for the game.
  2. public class Player {
  3. private String name, surname, username, password;
  4. private int gamesPlayed, totalScore;
  5.  
  6. //Constructor - assigns the arguments as the details of the new player.
  7. public Player (String name, String surname, String username, String password, int gamesPlayed, int totalScore)
  8. {
  9. this.name = name;
  10. this.surname = surname;
  11. this.username = username;
  12. this.password= password;
  13. this.gamesPlayed = 0; //default value
  14. this.totalScore = 0; //default value
  15. }
  16.  
  17. //Returns the current name
  18. public String getName()
  19. {
  20. return name;
  21. }
  22.  
  23. //Returns the current name
  24. public String getSurname()
  25. {
  26. return surname;
  27. }
  28.  
  29. //Returns the current username
  30. public String getUsername()
  31. {
  32. return username;
  33. }
  34.  
  35. //Returns the current password
  36. public String getPassword()
  37. {
  38. return password;
  39. }
  40.  
  41. //Returns the current value of gamesPlayed
  42. public int getGamesPlayed()
  43. {
  44. return gamesPlayed;
  45. }
  46.  
  47. //Returns the current value of totalScore
  48. public int getTotalScore()
  49. {
  50. return totalScore;
  51. }
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement