Separate displayed points from stored points

A rewards account begins with 82 points and provides the methods below. After the calling code finishes, determine the local variable displayed and the account's stored points. Give both answers as exact whole numbers of points.


Java
public int getPoints() {
    return points;
}

public void setPoints(int proposed) {
    points = proposed;
}


The following statements run on that account:


Java
int displayed = account.getPoints() + 9;
account.setPoints(displayed - 16);
displayed = displayed - 5;
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Accessors and Mutators Questions: