Question: The class has instance methods that can do simple math operations on two numbers. the methods are: plus, minus, multiply and divide . all the
The class has instance methods that can do simple math operations on two numbers.
the methods are: plus, minus, multiply and divide .
all the methods get two ints then the method does the required math operation and returns the result as an int.
for example:
Output of this program should be like:
1+1 = 2 2-3 = -1 2x3 = 6 10:2 = 5
----------------------
class Main {
public static void main(String[] args) { LameCalculator lc = new LameCalculator(); System.out.println("1+1 = "+lc.plus(1,1)); System.out.println("2-3 = "+lc.minus(2,3)); System.out.println("2x3 = "+lc.multiply(2,3)); System.out.println("10:2 = "+lc.divide(10,2)); } }
--------------------------------------------
class LameCalculator { //Your Code Here
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
