1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
postnew [5]
3 years ago
8

1. We want to add a button to the tally counter in Section 9.2 that allows an operator to undo an accidental button click. Provi

de a method def undo(self) that simulates such a button. As an added precaution, make sure an undo doesn't cause the counter to be less than zero. 5 pts a) Your code with comments b) A screenshot of the execution Test Case: Reset 2 clicks Print Value 1 click Print Value 2 undos Print Value 2 undos Print Value
Computers and Technology
1 answer:
serious [3.7K]3 years ago
5 0

Answer:

See explaination

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)

You might be interested in
How many grams are in 100 pounds?
stepan [7]

Answer:

45359.2 grams are in 100 pounds

Explanation:

Hope this helped, Have a Wonderful Day!!

3 0
3 years ago
Read 2 more answers
The ________ of the operating system enables users to communicate with the computer system. modem window network adapter card us
Marysya12 [62]

Well Formatted Question:

The _______ of the operating system enables users to communicate with the computer system.  

a) modem

b) window

c) network adapter card

d) user interface

Answer:

(d) user interface.

Explanation:

A user interface acts as a middleman between the user of a computer and the operating system of that computer. With the user interface, a user can easily communicate with the computer system including the applications running on it.

The user interface can either be text-based or graphics-based.

With text-based user interface, the user enters commands (using keyboards) in form of texts basically on the command line and then the operating system executes these commands.

With the graphical user interface, users interact with the computer using graphics-like control items such as buttons and menus to give instructions to the computer.

6 0
4 years ago
A computer that delivers requested webpages to your computer or mobile device is a(n) _________.
Zinaida [17]
Web server, probably.
6 0
3 years ago
Which exercise can help you prevent Carpel Tunnel Syndrome?
g100num [7]
Make a Fist, hold, and stretch your fingers is the correct answer
8 0
4 years ago
Read 2 more answers
Suppose we are now working with memory words of length 8. We have already calculated that we need 4 check bits, and the length o
krok68 [10]

Answer:

12

Explanation:

and it is also an error

7 0
3 years ago
Other questions:
  • Suppose Host A wants to send a large file to host B. The path from Host A to Host B has three links, of rates R1 = 500 kbps, R2=
    13·1 answer
  • Mobile Device Company (MDC) discovers that defamatory statements about its policies and products are being posted in an online f
    8·1 answer
  • Which of the following occurs when the amount of money earned is greater than the
    5·1 answer
  • Although designed to support remote dial-in access to a corporate network, what service below is commonly used with 802.1x port
    12·1 answer
  • Should a waiting thread receive priority over a thread first attempting to enter a monitor? What priority scheme, if any, should
    9·1 answer
  • Take the template and complete creation and ordering of the Triangular Matrix. //Complete the following Functions int**fillAry(i
    7·1 answer
  • Page Up and Page Down keys fall under the ? keys category.
    14·2 answers
  • Suppose the following groups are defined to shorten a system’s access control lists: – Group1: Alice, Bob, Cynthia, David, Eve –
    12·1 answer
  • The school tie is made from a piece of fabric measuring 135cm long by 9cm wide. The fabric is supplied in a roll that is 90mm wi
    14·1 answer
  • Software that communicates with the hardware and allows other programs to run. It is comprised of system software, or the fundam
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!