Answer:
See explaination
Step-by-step explanation:
class Counter:
def getValue(self):
return self._value
def undo(self):
if self._value > 0:
self._value = self._value - 1;
def click(self):
self._value= self._value + 1
def reset(self):
self._value= 0
tally= Counter()
tally.reset()
tally.click()
tally.click()
result = tally.getValue()
print("Value:", result)
tally.click()
result = tally.getValue()
print("Value:", result)
tally.undo()
tally.undo()
result = tally.getValue()
print("Value:", result)
tally.undo()
tally.undo()
result = tally.getValue()
print("Value:", result)