83.3k views
5 votes
Judging by the name of the method, which of the following methods would most likely be a mutator method?

a) getListOfDeposits.
b) printAccountBalance.
c) isOverdrawn.
d) updateDeposit.

User HYRY
by
8.0k points

1 Answer

0 votes

Final answer:

The method most likely to be a mutator is d) updateDeposit, as mutator methods are designed to change the state of an object and 'update' implies modification.

Step-by-step explanation:

Judging by the name of the method, the mutator method most likely to be identified here is d) updateDeposit. Mutator methods, also known as setters, are used to modify the state of an object. Given this definition, we can analyze the options provided:

  • a) getListOfDeposits sounds like an accessor method since it most likely retrieves a list without altering the object.
  • b) printAccountBalance seems like a method aimed at displaying information, not modifying it.
  • c) isOverdrawn appears to be a method that checks a condition, returning a boolean value to signify if an account is overdrawn, without changing any data.
  • d) updateDeposit implies a change is being made to the deposits, which is typical behavior of a mutator.
User Scottrakes
by
8.1k points