Question: IN JAVA PART A PART B 16 /*** 2 This class models a tally counter. 3 **/ 4 public class Counter 5 6 private int

IN JAVA

PART A

IN JAVA PART A PART B 16 /*** 2 This class models

a tally counter. 3 **/ 4 public class Counter 5 6 private

PART B

int value; 7 private int max; 8 90 public void setLimit(int maximum)

16 /*** 2 This class models a tally counter. 3 **/ 4 public class Counter 5 6 private int value; 7 private int max; 8 90 public void setLimit(int maximum) 10 { 11 max = maximum; 12 } 13 140 /** 15 Gets the current value of this counter. 16 @return the current value 17 */ 180 public int getValue() 19 { 20 return value; 21 } 22 236 /**** 24 Advances the value of this counter by 1. 25 */ public void count() 27 { 28 --Start below here. To do: approximate lines of code = 4 29 // increments value by 1. if value exceeds limit, print "Limit Exceeded" and reset value to o 30 31 32 33 34 35 36 -End here. Please do not remove this comment. Reminder: no changes outside the todo regions. 37 } 38 390 /**** 40 Resets the value of this counter to 0. 41 */ 424 public void reset() 43 { 44 value = 0; 45 } 46 266 6 9 14 1 2 public class CounterTester 3 40 public static void main(String[] args) 5 { Counter c1 = new Counter(); 7 c1.setLimit(100); 8 for (int i = 0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!