Performing operations without using ARithmetic Operators

Guys!

Please help me I have this lab exercise and I really dont know what to do.. Im desperate :(

My professor posted this:

Objectives:

- To let the participants experience the use of loops and operators.

Create a Java Application using the class BasicMathOperation. The application will initialize two integer values and display the ff:

a. Product without using the multiplication (‘*’) operator.

b. Integer quotient without using the division (‘/’) operator.

c. Integer remainder without using the modulo (‘%’) operator.

d. Take note that inside the whole code, you are NOT allowed to use the ff: operators: ‘*’, ‘/’, and ‘%’.

Save your file as ICS112_Section_Exercise3_Surname_ComputerNumber.ja va (ie: ICS112_1ITB_Beltran_25.java)

Class BasicMathOperation UML Diagram

BasicMathOperation

- operand1 : int

- operand2 : int

//constructor

+ BasicMathOperation(int num1, int num2)

//setters

+ setOperand1(int num1) : void

+ setOperand2(int num2) : void

//getters

+ getOperand1() : int

+ getOperand2() : int

//basic methods

+ multiplyUsingLoop() : int

+ divideUsingLoop() : int

+ moduloUsingLoop() : int

Note: To avoid division by zero, the operand2 must have no value of zero. Same is true to modulo by zero, that is, the operand2 must have no value of zero. And this condition must be checked in the methods divideUsingLoop() and moduloUsingLoop(). If this happen, the output is “Error division by zero” or “Error modulo of zero”, respectively. And the program exit using the command System.exit(1).

Re: Performing operations without using ARithmetic Operators

Harness that desperation and make an effort to understand the assignment, formulate a design, and write some code. We can't help you with code, but I can suggest that you work the problem one piece at a time and work it through, breaking it into even smaller, more manageable pieces, if necessary. When you have some code that you need help with, please come back. Post code and any errors you want help with, code posted in code tags.

Good luck!

Re: Performing operations without using ARithmetic Operators

Thank you thank you :) I'll do that.

--- Update ---

I dont know how to start.. Im just a beginner and Ive been searching about this topic for how many hours. My professor didnt taught us how to do this. He just posted this. Help help help :(