Hi, I need some help writing this small function. It's supposed to accept a double value as degrees and return the radian equivalent. If the degrees is positive, it will return a value from 0 and 2 * PI, but not including 2 * PI. If the input is negative, it will return a value between 0 and -2 * PI.
It seemed simple but when I tried to add in the negative values I messed it up. Could I have a bit of help? Thank you.
When I submit it to my homework website, it fails the automatic tests the site runs. I get the following errors returned:
Running cxxtest tests (<enough tests>)
In MyDeg2Rad::test6:
mylib_test.h:82: Error: Expected (degreesToRadians(0.0 + 360.0) == 0.0) up to 0.01 (0.0100), found (6.2831 != 0.0000)
In MyDeg2Rad::test7:
mylib_test.h:86: Error: Expected (degreesToRadians(45 + 360.0) == PI/4) up to 0.01 (0.0100), found (7.0685 != 0.7853)
In MyDeg2Rad::test8:
mylib_test.h:90: Error: Expected (degreesToRadians(90 + 360.0) == PI/2) up to 0.01 (0.0100), found (7.8539 != 1.5707)
In MyDeg2Rad::test9:
mylib_test.h:94: Error: Expected (degreesToRadians(180 + 360.0) == PI) up to 0.01 (0.0100), found (9.4247 != 3.1415)
In MyDeg2Rad::test10:
mylib_test.h:98: Error: Expected (degreesToRadians(270 + 360.0) == PI*3/2) up to 0.01 (0.0100), found (10.9955 != 4.7123)
In MyDeg2Rad::test11:
mylib_test.h:102: Error: Expected (degreesToRadians(-360.0) == 0.0) up to 0.01 (0.0100), found (-6.2831 != 0.0000)