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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

Compare and Contrast file Systems with database systems?

Answered: 1 week ago

Question

Define Data Abstraction and dinsuun levels of Abstraction?

Answered: 1 week ago

Question

Explain ACID properties and Illustrate them through examples?

Answered: 1 week ago

Question

Discuss How do you implement Atomicity and Durability?

Answered: 1 week ago

Question

Discuss about Complex integrity constraints in SQL?

Answered: 1 week ago