top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

Create a Java Application using the class BasicMathOperation and display the ouput?

+1 vote

Good day, my assignment is similar to this can you help me??? I really dont know what to do.

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 output:
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 (ie:

Class BasicMathOperation UML Diagram
- operand1 : int
- operand2 : int
+ BasicMathOperation(int num1, int num2)
+ setOperand1(int num1) : void
+ setOperand2(int num2) : void
+ 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).

posted May 8, 2017 by Azhar Keer

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.