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:
An integer member variable num that is a multiple of three at all times.
A getter
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.
A Default constructor that sets num to
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.
A method toString that return the object as a string
A method equals that accepts a MultipleThree Object and return true if the two objects are equal and false otherwise
A method add that accepts an integer and return a MultipleThree object with num set to the sum of num and the input
Overload the method add to accept a MultipleThree object abd return a MultipleThree object as the sum of the two.
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
