Cody

# Problem 496. Oxidation State

Solution 1923981

Submitted on 6 Sep 2019
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
x='sulphuric acid H2SO4'; y = 0-(2*1+4*-2); assert(isequal(y,oxno(x)))

s = 'H2SO4'

Error using str2num (line 35) Input must be a character vector or string scalar. Error in oxno (line 26) l4=str2num(l3); Error in Test1 (line 3) assert(isequal(y,oxno(x)))

2   Fail
x='sodium hydroxide NaOH'; y = 0-(-2+1); assert(isequal(y,oxno(x)))

s = 'NaOH' l2 = 1 l3 = 1 l4 = 1

Output argument "y" (and maybe others) not assigned during call to "oxno". Error in Test2 (line 3) assert(isequal(y,oxno(x)))

3   Fail
x='methane CH4'; y = 0-(4*1); assert(isequal(y,oxno(x)))

s = 'CH4' l2 = 1 l3 = 4 l4 = 1

Output argument "y" (and maybe others) not assigned during call to "oxno". Error in Test3 (line 3) assert(isequal(y,oxno(x)))

4   Fail
x='ethane C2H6'; y = 0-(6*1)/2; assert(isequal(y,oxno(x)))

s = 'C2H6' l2 = 2 l3 = 6 l4 = 1

Output argument "y" (and maybe others) not assigned during call to "oxno". Error in Test4 (line 3) assert(isequal(y,oxno(x)))

5   Fail
x='acetylene C2H2'; y = 0-(2*1)/2; assert(isequal(y,oxno(x)))

s = 'C2H2' l2 = 2 l3 = 2 l4 = 1

Output argument "y" (and maybe others) not assigned during call to "oxno". Error in Test5 (line 3) assert(isequal(y,oxno(x)))

6   Fail
x='hypophosphorous acid H3PO2'; y = 1; assert(isequal(y,oxno(x)))

s = 'H3PO2'

Error using str2num (line 35) Input must be a character vector or string scalar. Error in oxno (line 26) l4=str2num(l3); Error in Test6 (line 3) assert(isequal(y,oxno(x)))

7   Fail
x='(ortho)phosphorous acid H3PO3'; y = 3; assert(isequal(y,oxno(x)))

s = 'H3PO3'

Error using str2num (line 35) Input must be a character vector or string scalar. Error in oxno (line 26) l4=str2num(l3); Error in Test7 (line 3) assert(isequal(y,oxno(x)))

8   Fail
x='pyrophosphoric acid H4P2O7'; y = 5; assert(isequal(y,oxno(x)))

s = 'H4P2O7'

Error using str2num (line 35) Input must be a character vector or string scalar. Error in oxno (line 26) l4=str2num(l3); Error in Test8 (line 3) assert(isequal(y,oxno(x)))