Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package vocabbuilder;
- //This class defines a player for the game.
- public class Player {
- private String name, surname, username, password;
- private int gamesPlayed, totalScore;
- //Constructor - assigns the arguments as the details of the new player.
- public Player (String name, String surname, String username, String password, int gamesPlayed, int totalScore)
- {
- this.name = name;
- this.surname = surname;
- this.username = username;
- this.password= password;
- this.gamesPlayed = 0; //default value
- this.totalScore = 0; //default value
- }
- //Returns the current name
- public String getName()
- {
- return name;
- }
- //Returns the current name
- public String getSurname()
- {
- return surname;
- }
- //Returns the current username
- public String getUsername()
- {
- return username;
- }
- //Returns the current password
- public String getPassword()
- {
- return password;
- }
- //Returns the current value of gamesPlayed
- public int getGamesPlayed()
- {
- return gamesPlayed;
- }
- //Returns the current value of totalScore
- public int getTotalScore()
- {
- return totalScore;
- }
- }
Add Comment
Please, Sign In to add comment