Jeremy B.

asked • 11/11/16

python help

need help writing this code in python please: I keep getting it incorrect.
 
Write the definition of a class Counter containing:
An instance variable named counter of type int
An instance variable named limit of type int.
A constructor that takes two int arguments and assigns the first one to counter and the second one to limit
A method named increment. It does not take parameters or return a value; if the instance variable counter is less than limit, increment just adds one to the instance variable counter.
A method named decrement. It also does not take parameters or return a value; if counter is greater than zero, it just subtracts one from the counter.
A method named get_value that returns the value of the instance variable counter.

1 Expert Answer

By:

Christopher W. answered • 06/08/17

Tutor
5.0 (37)

Very Knowledgable and Patient Computer Programming Tutor

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.