Interface
Define a MathOp interface that has four methodsfor add, subtract,multiply, and divide. Thesemethods only work with integers.
Implementation
You will write a class that implements MathOp to supportarithmetic operations. Each method should have two parameters. Thedivide method will throw an exception if the divisor is 0.
Write a program that uses the interface andimplementation to allow the users to perform somearithmetic.
Sample run (text marked as bold are userinputs):
run:
1)add, 2)sub, 3)multiply, 4) divide, 5)exit:1
Enter operands:2 4
6
1)add, 2)sub, 3)multiply, 4) divide, 5)exit:2
Enter operands:4 2
2
1)add, 2)sub, 3)multiply, 4) divide, 5)exit:3
Enter operands:2 3
6
1)add, 2)sub, 3)multiply, 4) divide, 5)exit:4
Enter operands:3 2
1
1)add, 2)sub, 3)multiply, 4) divide, 5)exit:4
Enter operands:2 1
2
1)add,
PayPal Gateway not configured
PayPal Gateway not configured