Cody

Problem 2413. Temperature Conversion Utility

Solution 2672645

Submitted on 9 Jul 2020
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)

pair = 'CF'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test1 (line 5) assert(abs(T_convertor(T,u1,u2)-212) < eps)

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

pair = 'CR'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test2 (line 5) assert(abs(T_convertor(T,u1,u2)-671.67) < eps)

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

pair = 'CC'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test3 (line 5) assert(abs(T_convertor(T,u1,u2)-100) < eps)

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

pair = 'CK'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test4 (line 5) assert(abs(T_convertor(T,u1,u2)-373.15) < eps)

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

pair = 'KF'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test5 (line 5) assert(abs(T_convertor(T,u1,u2)-(-279.67)) < eps)

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

pair = 'KR'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test6 (line 5) assert(abs(T_convertor(T,u1,u2)-180) < eps)

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

pair = 'KC'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test7 (line 5) assert(abs(T_convertor(T,u1,u2)-(-173.15)) < eps)

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

pair = 'KK'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test8 (line 5) assert(abs(T_convertor(T,u1,u2)-100) < eps)

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

pair = 'FF'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test9 (line 5) assert(abs(T_convertor(T,u1,u2)-100) < eps)

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

pair = 'FR'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test10 (line 5) assert(abs(T_convertor(T,u1,u2)-559.67) < eps)

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

pair = 'FC'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test11 (line 5) assert(abs(T_convertor(T,u1,u2)-37.7777778) < eps)

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

pair = 'FK'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test12 (line 5) assert(abs(T_convertor(T,u1,u2)-310.9277778) < eps)

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

pair = 'RF'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test13 (line 5) assert(abs(T_convertor(T,u1,u2)-(-359.67)) < eps)

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

pair = 'RR'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test14 (line 5) assert(abs(T_convertor(T,u1,u2)-100) < eps)

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

pair = 'RC'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test15 (line 5) assert(abs(T_convertor(T,u1,u2)-(-217.5944444)) < eps)

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

pair = 'RK'

Undefined function 'convertStringstoChars' for input arguments of type 'string'. Error in T_convertor (line 11) l = convertStringstoChars(" (?@ " + regexprep(l,'T',num2str(T)) + " ) ") Error in Test16 (line 5) assert(abs(T_convertor(T,u1,u2)-55.5555556) < eps)

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!