Answered step by step
Verified Expert Solution
Question
1 Approved Answer
need the source from NetBeans IDE 8.2 please We want to add a button to the tally counter in Section 3.1 that allows an operator
need the source from NetBeans IDE 8.2 please
We want to add a button to the tally counter in Section 3.1 that allows an operator to undo an accidental button click. Provide a method public void undo ) that simulates such a button. As an added precaution, make sure that clicking the undo button cannot take the counter to less than zero. (Hint: The call Math.ma. (, returns n if n is greater than zero, zero otherwise.) Add the capability for a tally counter that can be used to admit a limited number of people. First the limit is set with a call public void setLimit(int newLimit) If the click button is clicked more often than the limit it has not effect Hint The call Math.min(n,limit) returns n if n is less than limit. and limit otherwise. Your declaration for limit should be: int limitnte a large value by default.) MAX VALUE to initialize it to ublic class Countert private int value: public void clicko ( valuerti publiciintigetvale return vailu value 1:37 PM ents T36183 that simulates such a button. As an added precaution, make sure that clicking the undo button cannot take the counter to less than zero. (Hint: The call Math.max (n, 0) returns n if n is greater than zero, zero otherwise.) Add the capability for a tally counter that can be used to admit a limited number of people. First the limit is set with a call public void setlimit (int nowtimit) If the click button is clicked more often than the limit, it has not effect. (Hint: The call Math.min (n,limit) returns n if n is less than limit, and limit otherwise. Your declaration for limit should be: int limit - Integer. MAX VALUE to initialize it to a large value by default.) public class counter t private int value: public void clickO t value++ public int getvalue O f return value: public void reset Ot value-0; public static void main(String) args) Counter c1new Counter (); c1.clickO: c1.click)i system.out.println(c1.getvalue ()): c1 . reset ( ) ; system. out.printin(c1.getvalue 0)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started