Problem

(The EvenNumber class) Revise the EvenNumber class in Programming Exercise to implement th...

(The EvenNumber class) Revise the EvenNumber class in Programming Exercise to implement the preincrement, predecrement, postincrement, and post-decrement operators for getNext() and getPrevious() functions. Write a test program that creates an EvenNumber object for value 16 and invokes the ++ and -- operators to obtain next and previous even nu1mbers.

Programming Exercise (The EvenNumber class) Define the EvenNumber class for representing an even number. The class contains:

A data field value of the int type that represents the integer value stored in the object.

A no-arg constructor that creates an EvenNumber object for the value 0.

A constructor that constructs an EvenNumber object with the specified value.

A function named getVa1ue() to return an int value for this object.

A function named getNext() to return an EvenNumber object that represents the next even number after the current even number in this object.

A function named getPrevious() to return an EvenNumber object that rep­resents the previous even number before the current even number in this object.

Draw the UML diagram for the class. Implement the class. Write a test program that creates an EvenNumber object for value 16 and invokes the getNext() and getPrevious() functions to obtain and displays these numbers.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT