Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.elsys.postfix.operations;
- import org.elsys.postfix.Calculator;
- public class TernarOperation extends AbstractOperation implements Operation{
- public TernarOperation(Calculator calculator)
- {
- super(calculator, "\\*-\\*");
- }
- @Override
- public void calculate() {
- double value1 = getCalculator().popValue();
- double value2 = getCalculator().popValue();
- double value3 = getCalculator().popValue();
- double result = value1 * value2 * value3;
- getCalculator().addValue(-result);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement