Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Class name Cntr -count : int -min : int -max : int +Counter() +Counter(c: int, mn: int, mx: int) +Counter(c: int) +setCount(c: int) :

JAVA Class name Cntr

-count : int

-min : int

-max : int

+Counter()

+Counter(c: int, mn: int, mx: int)

+Counter(c: int) +setCount(c: int) : void

+getCount() : int +setMin(mn: int) : void

+getMin() : int +setMax(mx: int) : void

+getMax() : void +increment() : void

+decrement() : void

The default value for all field values is 0.

The min and max values determine the valid interval for the count value. If both values are 0, then no interval exists and the count value is unrestricted.

If an interval exists, the count value should not be outside the range of the interval. If any operation is attempted that would cause the count to be outside the interval, a message indicating the issue should be displayed and the change should not be made.

The min value must always be lower than the max value. If any operation is attempted that would cause this not to be true, a message indicating the issue should be displayed and the change should not be made.

The max value must always be higher than the min value. If any operation is attempted that would cause this not to be true, a message indicating the issue should be displayed and the change should not be made.

The increment method should increase the count value by 1 and The decrement method should decrease the count value by 1.

You will need to write a demo class to test your design.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago