Guest User

Untitled

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