Commit b2d392d1 authored by Justin Dearden's avatar Justin Dearden
Browse files

Version 2: Implemented pow/rad/fact functions - base tests passing

parent 8716b780
......@@ -9,13 +9,14 @@ public class TrigFunctionTest {
/* Test case to check the Factorial function
*
* */
@SuppressWarnings("deprecation")
@Test
public void testFactorial() {
int i = 4;
int expected = 24;
double actual = TrigFunctions.factorial(i);
assertEquals("Testing the factorial function",expected, actual);
assertEquals(expected, actual, 0);
}
/* Test case to check the Power function
......@@ -28,7 +29,7 @@ public class TrigFunctionTest {
double expected = Math.pow(i, j);
double actual = TrigFunctions.power(i, j);
assertEquals("Testing the power function",expected, actual);
assertEquals(expected, actual, 0);
}
/* Test case to check the toRadian function
......@@ -40,7 +41,7 @@ public class TrigFunctionTest {
double expected = Math.toRadians(degrees);
double actual = TrigFunctions.toRadian(degrees);
assertEquals("Testing the toRadian function",expected, actual);
assertEquals(expected, actual, 0);
}
......
package test;
package assignment2B;
public class TrigFunctions {
public static double factorial(int i) {
return 0;
if (i == 1) {
return 1;
}
return i * TrigFunctions.factorial(i - 1);
}
public static double power(double i, double j) {
return 0;
public static double power(double base, double power) {
double results = base;
for (int j = 1; j < power; j++) {
results = results * base;
}
return results;
}
public static double toRadian(double degrees) {
return 0;
double result = degrees * (3.141592653589793 / 180);
return result;
}
// Lets us pass in which mode we want
public enum TYPE {
RADIANS,
DEGREES
}
public static double sin(double degrees) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment