Cody

Problem 2413. Temperature Conversion Utility

Solution 1124386

Submitted on 16 Feb 2017 by Jihye Sofia Seo
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   Pass
T = 100; u1 = 'C'; u2 = 'F'; eps = 1e-4; assert(abs(T_convertor(T,u1,u2)-212) < eps)

C = 100 T = 212

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

C = 100 T = 671.6700

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

C = 100 T = 100

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

C = 100 T = 373.1500

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

C = -173.1500 T = -279.6700

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

C = -173.1500 T = 180

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

C = -173.1500 T = -173.1500

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

C = -173.1500 T = 100

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

C = 37.7778 T = 100

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

C = 37.7778 T = 559.6700

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

C = 37.7778 T = 37.7778

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

C = 37.7778 T = 310.9278

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

C = -217.5944 T = -359.6700

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

C = -217.5944 T = 100.0000

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

C = -217.5944 T = -217.5944

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

C = -217.5944 T = 55.5556

Suggested Problems

More from this Author139

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!