This repository has been archived on 2026-10-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
projectstem-keys-java/High Scores/Part A/Player.java
T
2024-03-18 11:15:45 -07:00

38 lines
768 B
Java

/* COMPLETE WORKING CLASS PROVIDED */
/* DO NOT MODIFY THE IMPLEMENTATION OF THIS CLASS*/
public class Player
{
private String playerName;
private int highScore;
public Player (String name, int score)
{
playerName = name;
highScore = score;
}
/** @param score an int value representing the player's most recent score
* updates the value of highScore to score if this is higher than the current value
*/
public void updateScore(int score)
{
if(score > highScore)
highScore = score;
}
/** @return the player's name
*/
public String getName()
{ return playerName; }
/** @return the high score of the player
*/
public int getHighScore()
{ return highScore; }
}