Cody

# Problem 2413. Temperature Conversion Utility

Solution 1387679

Submitted on 20 Dec 2017
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Fail
T = 100; u1 = 'C'; u2 = 'F'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-212) < eps)

r = 1 c = 3 T_out = NaN

Assertion failed.

2   Fail
T = 100; u1 = 'C'; u2 = 'R'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-671.67) < eps)

r = 1 c = 4 T_out = NaN

Assertion failed.

3   Pass
T = 100; u1 = 'C'; u2 = 'C'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-100) < eps)

r = 1 c = 1 T_out = 100

4   Fail
T = 100; u1 = 'C'; u2 = 'K'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-373.15) < eps)

r = 1 c = 2 T_out = 337.1500

Assertion failed.

5   Fail
T = 100; u1 = 'K'; u2 = 'F'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-(-279.67)) < eps)

r = 2 c = 3 T_out = NaN

Assertion failed.

6   Fail
T = 100; u1 = 'K'; u2 = 'R'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-180) < eps)

r = 2 c = 4 T_out = NaN

Assertion failed.

7   Pass
T = 100; u1 = 'K'; u2 = 'C'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-(-173.15)) < eps)

r = 2 c = 1 T_out = -173.1500

8   Pass
T = 100; u1 = 'K'; u2 = 'K'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-100) < eps)

r = 2 c = 2 T_out = 100

9   Pass
T = 100; u1 = 'F'; u2 = 'F'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-100) < eps)

r = 3 c = 3 T_out = 100

10   Pass
T = 100; u1 = 'F'; u2 = 'R'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-559.67) < eps)

r = 3 c = 4 T_out = 559.6700

11   Fail
T = 100; u1 = 'F'; u2 = 'C'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-37.7777778) < eps)

r = 3 c = 1 T_out = NaN

Assertion failed.

12   Fail
T = 100; u1 = 'F'; u2 = 'K'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-310.9277778) < eps)

r = 3 c = 2 T_out = NaN

Assertion failed.

13   Pass
T = 100; u1 = 'R'; u2 = 'F'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-(-359.67)) < eps)

r = 4 c = 3 T_out = -359.6700

14   Pass
T = 100; u1 = 'R'; u2 = 'R'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-100) < eps)

r = 4 c = 4 T_out = 100

15   Fail
T = 100; u1 = 'R'; u2 = 'C'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-(-217.5944444)) < eps)

r = 4 c = 1 T_out = NaN

Assertion failed.

16   Fail
T = 100; u1 = 'R'; u2 = 'K'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-55.5555556) < eps)

r = 4 c = 2 T_out = NaN

Assertion failed.