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 ICS112_Section_Exercise3_Surname_ComputerNumber.java (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).