Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. package org.elsys.postfix.operations;
  2. import org.elsys.postfix.Calculator;
  3.  
  4. public class TernarOperation extends AbstractOperation implements Operation{
  5. public TernarOperation(Calculator calculator)
  6. {
  7. super(calculator, "\\*-\\*");
  8. }
  9.  
  10. @Override
  11. public void calculate() {
  12. double value1 = getCalculator().popValue();
  13. double value2 = getCalculator().popValue();
  14. double value3 = getCalculator().popValue();
  15. double result = value1 * value2 * value3;
  16. getCalculator().addValue(-result);
  17. }
  18.  
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement