Test  Status  Code Input and Output 

1  Pass 
%%
frac_str = 'twosevenths of fiveninths of threeeighths of 168';
assert(isequal(round(fraction_of_a(frac_str)),10))

2  Pass 
%%
frac_str = 'onefifth of fourhalfs of threefourths of 100';
assert(isequal(round(fraction_of_a(frac_str)),30))

3  Pass 
%%
frac_str = 'twothirds of threefourths of onefifth of 150';
assert(isequal(round(fraction_of_a(frac_str)),15))

4  Pass 
%%
frac_str = 'fivesevenths of fourfifths of threehalfs of twosixths of onefourth of 210';
assert(isequal(round(fraction_of_a(frac_str)),15))

5  Pass 
%%
frac_str = 'oneseventh of twoninths of 630';
assert(isequal(round(fraction_of_a(frac_str)),20))

6  Pass 
%%
frac_str = 'onehalf of threefifths of twothirds of threefourths of 1000';
assert(isequal(round(fraction_of_a(frac_str)),150))

7  Pass 
%%
frac_str = 'onehalf of twothirds of threefourths of fourfifths of fivesixths of sixsevenths of seveneighths of eightninths of 36288';
assert(isequal(round(fraction_of_a(frac_str)),4032))

8  Pass 
%%
frac_str = 'oneninth of twoeighths of threesevenths of foursixths of fivefifths of sixfourths of seventhirds of eighthalfs of 36288';
assert(isequal(round(fraction_of_a(frac_str)),4032))

9  Pass 
%%
ind = randi(4);
switch ind
case 1
frac_str = 'twosevenths of fiveninths of threeeighths of 168';
assert(isequal(round(fraction_of_a(frac_str)),10))
case 2
frac_str = 'onefifth of fourhalfs of threefourths of 100';
assert(isequal(round(fraction_of_a(frac_str)),30))
case 3
frac_str = 'twothirds of threefourths of onefifth of 150';
assert(isequal(round(fraction_of_a(frac_str)),15))
case 4
frac_str = 'oneninth of twoeighths of threesevenths of foursixths of fivefifths of sixfourths of seventhirds of eighthalfs of 36288';
assert(isequal(round(fraction_of_a(frac_str)),4032))
end

10  Pass 
%%
ind = randi(4);
switch ind
case 1
frac_str = 'onehalf of twothirds of threefourths of fourfifths of fivesixths of sixsevenths of seveneighths of eightninths of 36288';
assert(isequal(round(fraction_of_a(frac_str)),4032))
case 2
frac_str = 'onefifth of fourhalfs of threefourths of 100';
assert(isequal(round(fraction_of_a(frac_str)),30))
case 3
frac_str = 'oneseventh of twoninths of 630';
assert(isequal(round(fraction_of_a(frac_str)),20))
case 4
frac_str = 'twothirds of threefourths of onefifth of 150';
assert(isequal(round(fraction_of_a(frac_str)),15))
end

11  Pass 
%%
ind = randi(4);
switch ind
case 1
frac_str = 'onefifth of fourhalfs of threefourths of 100';
assert(isequal(round(fraction_of_a(frac_str)),30))
case 2
frac_str = 'twosevenths of fiveninths of threeeighths of 168';
assert(isequal(round(fraction_of_a(frac_str)),10))
case 3
frac_str = 'onehalf of twothirds of threefourths of fourfifths of fivesixths of sixsevenths of seveneighths of eightninths of 36288';
assert(isequal(round(fraction_of_a(frac_str)),4032))
case 4
frac_str = 'oneseventh of twoninths of 630';
assert(isequal(round(fraction_of_a(frac_str)),20))
end

160 Solvers
Back to basics 17  white space
239 Solvers
412 Solvers
Given a 4x4 matrix, swap the two middle columns
497 Solvers
Moving average (variable kernel length)
99 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!