Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

3rd Edition

0760049041, 978-0760049044

More Books

Students also viewed these Databases questions