Calculator { public Double calculateMono(MonoOperatorModes newMode, Double num) { if (newMode == MonoOperatorModes.square) { return num * num; } if (newMode == MonoOperatorModes.squareRoot) { return Math.sqrt(num); } if (newMode == MonoOperatorModes.oneDividedBy) { return 1 / num; } if (newMode == MonoOperatorModes.cos) { return Math.cos(Math.toRadians(num)); } if (newMode == MonoOperatorModes.sin) { return Math.sin(Math.toRadians(num)); } if (newMode == MonoOperatorModes.tan) { if (num == 0 || num % 180 == 0) { return 0.0; } if (num % 90 == 0 && num % 180 != 0) { return NaN; } return Math.tan(Math.toRadians(num)); } if (newMode == MonoOperatorModes.log) { return log10(num); } if (newMode == MonoOperatorModes.rate) { return num / 100; } if (newMode == MonoOperatorModes.abs){ return Math.abs(num); } throw new Error(); }  Double calculateBi(BiOperatorModes newMode, Double num); Double calculateEqual(Double num); Double reset(); Double calculateMono(MonoOperatorModes newMode, Double num);  }
@Test void CalculateMonoSinTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(0.5, calculator.calculateMono(Calculator.MonoOperatorModes.sin, java.lang.Math.PI / 6), 0.0000000001); }
@Test void CalculateMonoCosTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(0.5, calculator.calculateMono(Calculator.MonoOperatorModes.cos, java.lang.Math.PI / 3), 0.0000000001); }
@Test void CalculateMonoTanTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(1.0, calculator.calculateMono(Calculator.MonoOperatorModes.tan, java.lang.Math.PI / 4), 0.0000000001); }
@Test void CalculateMonoLogTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(2.0, calculator.calculateMono(Calculator.MonoOperatorModes.log, 100.0)); }
@Test void CalculateMonoRateTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(.75, calculator.calculateMono(Calculator.MonoOperatorModes.rate, 75.0)); }
@Test void CalculateMonoAbsTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(3.0, calculator.calculateMono(Calculator.MonoOperatorModes.abs, -3.0)); Assertions.assertEquals(3.0, calculator.calculateMono(Calculator.MonoOperatorModes.abs, 3.0)); }
@Test void CalculateMonoSquareTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(9.0, calculator.calculateMono(Calculator.MonoOperatorModes.square, 3.0)); }
@Test void CalculateMonoSquareRootTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(5.0, calculator.calculateMono(Calculator.MonoOperatorModes.squareRoot, 25.0)); }
@Test void CalculateMonoOneDividedByTest() { Calculator calculator = new Calculator(); Assertions.assertEquals(0.10, calculator.calculateMono(Calculator.MonoOperatorModes.oneDividedBy, 10.0)); }