Question: Design and code a class MultipleThree th ahas the following properties: 1 - An integer member variable num that is a multiple of three at

Design and code a class MultipleThree th ahas the following properties:
1- An integer member variable num that is a multiple of three at all times.
2- A getter
3- A setter that accepts an integer and sets num to that integer if it's a multiple of three, otherwise it sets it
to the next number that's multiple of three.
4- A Default constructor that sets num to 0
5- A constructor that accepts an integer and sets num to that integer if it's a multiple of three, otherwise it sets it
to the next number that's multiple of three.
6- A method toString that return the object as a string
7- A method equals that accepts a MultipleThree Object and return true if the two objects are equal and false otherwise
8- A method add that accepts an integer and return a MultipleThree object with num set to the sum of num and the input
9- Overload the method add to accept a MultipleThree object abd return a MultipleThree object as the sum of the two.
10- Write a tester class to test all methods and constructors of your class.

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!