Answer to Question #279448 in Java | JSP | JSF for Hab1bti

Question #279448

Getters



for



the



name



(


String


),



number



of



points



(


int


),



and



number



of



wins



(


int


).



These



should be called



getName()


,



getScore()


, and



getWins()


, respectively.





A method



addPoints()


, which takes in an



int



and adds that number to the total number of



points the user has.





A method



resetScore()


, which takes no arguments and resets the player’s score to zero.



1
Expert's answer
2021-12-14T09:30:51-0500
public class Player {
    private String name;
    private int score;
    private int wins;

    public String getName() {
        return name;
    }

    public int getScore() {
        return score;
    }

    public int getWins() {
        return wins;
    }

    public void addPoints(int points) {
        score += points;
    }

    public void resetScore() {
        score = 0;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog