MainApplication.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. ;
  2. /**
  3. * Created by leon on 2/9/18.
  4. */
  5. import java.util.*;
  6. public class MainApplication {
  7. public static void main(String[] args) {
  8. System.out.println("\n ========v1 Calculator========");
  9. System.out.println("0");
  10. boolean power = true;
  11. Double mem = 0.0;
  12. Double[] operandHolder = new Double[100];
  13. String[] operatorHolder = new String[100];
  14. Arrays.fill(operatorHolder,"0");
  15. while(power){
  16. Console.SaveParameter(Console.getDoubleInput("Enter a number"), operandHolder);
  17. //Console.println("\n" + Arrays.toString(operandHolder));
  18. //Console.println(Arrays.toString(operatorHolder) + "\n");
  19. Console.DisplayCurrent(operandHolder,operatorHolder);
  20. Console.SaveParameter(Console.getStringInput("Enter an operator "), operatorHolder);
  21. //Console.println("\n" + Arrays.toString(operandHolder));
  22. //Console.println(Arrays.toString(operatorHolder) + "\n");
  23. Calculator.Inverter(operatorHolder, operandHolder);
  24. //Calculator.SignInvert(operatorHolder, operandHolder);
  25. Calculator.ClearMem(operatorHolder, operandHolder);
  26. Calculator.MemStore(operatorHolder, operandHolder, mem);
  27. power = !Calculator.OperatorChecker(operatorHolder,"end");
  28. if(Calculator.OperatorChecker(operatorHolder, "=" )){
  29. Calculator.BasicComputing(operatorHolder, operandHolder);
  30. Console.DisplayCurrent(operandHolder,operatorHolder);
  31. Console.SaveParameter(Console.getStringInput("Enter an operator "), operatorHolder);
  32. }
  33. power = !Calculator.OperatorChecker(operatorHolder,"end");
  34. Console.DisplayCurrent(operandHolder,operatorHolder);
  35. }
  36. //Console.println(Arrays.toString(operandHolder));
  37. //Console.println(Arrays.toString(operatorHolder));
  38. }
  39. }