Cody

Problem 42316. Fraction of a fraction of a ...

Solution 686995

Submitted on 15 Jun 2015
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
%% frac_str = 'two-sevenths of five-ninths of three-eighths of 168'; assert(isequal(round(fraction_of_a(frac_str)),10))

Assertion failed.

2   Fail
%% frac_str = 'one-fifth of four-halfs of three-fourths of 100'; assert(isequal(round(fraction_of_a(frac_str)),30))

Assertion failed.

3   Fail
%% frac_str = 'two-thirds of three-fourths of one-fifth of 150'; assert(isequal(round(fraction_of_a(frac_str)),15))

Assertion failed.

4   Fail
%% frac_str = 'five-sevenths of four-fifths of three-halfs of two-sixths of one-fourth of 210'; assert(isequal(round(fraction_of_a(frac_str)),15))

Assertion failed.

5   Fail
%% frac_str = 'one-seventh of two-ninths of 630'; assert(isequal(round(fraction_of_a(frac_str)),20))

Assertion failed.

6   Fail
%% frac_str = 'one-half of three-fifths of two-thirds of three-fourths of 1000'; assert(isequal(round(fraction_of_a(frac_str)),150))

Assertion failed.

7   Fail
%% frac_str = 'one-half of two-thirds of three-fourths of four-fifths of five-sixths of six-sevenths of seven-eighths of eight-ninths of 36288'; assert(isequal(round(fraction_of_a(frac_str)),4032))

Assertion failed.

8   Fail
%% frac_str = 'one-ninth of two-eighths of three-sevenths of four-sixths of five-fifths of six-fourths of seven-thirds of eight-halfs of 36288'; assert(isequal(round(fraction_of_a(frac_str)),4032))

Assertion failed.

9   Fail
%% ind = randi(4); switch ind case 1 frac_str = 'two-sevenths of five-ninths of three-eighths of 168'; assert(isequal(round(fraction_of_a(frac_str)),10)) case 2 frac_str = 'one-fifth of four-halfs of three-fourths of 100'; assert(isequal(round(fraction_of_a(frac_str)),30)) case 3 frac_str = 'two-thirds of three-fourths of one-fifth of 150'; assert(isequal(round(fraction_of_a(frac_str)),15)) case 4 frac_str = 'one-ninth of two-eighths of three-sevenths of four-sixths of five-fifths of six-fourths of seven-thirds of eight-halfs of 36288'; assert(isequal(round(fraction_of_a(frac_str)),4032)) end

Assertion failed.

10   Fail
%% ind = randi(4); switch ind case 1 frac_str = 'one-half of two-thirds of three-fourths of four-fifths of five-sixths of six-sevenths of seven-eighths of eight-ninths of 36288'; assert(isequal(round(fraction_of_a(frac_str)),4032)) case 2 frac_str = 'one-fifth of four-halfs of three-fourths of 100'; assert(isequal(round(fraction_of_a(frac_str)),30)) case 3 frac_str = 'one-seventh of two-ninths of 630'; assert(isequal(round(fraction_of_a(frac_str)),20)) case 4 frac_str = 'two-thirds of three-fourths of one-fifth of 150'; assert(isequal(round(fraction_of_a(frac_str)),15)) end

Assertion failed.

11   Fail
%% ind = randi(4); switch ind case 1 frac_str = 'one-fifth of four-halfs of three-fourths of 100'; assert(isequal(round(fraction_of_a(frac_str)),30)) case 2 frac_str = 'two-sevenths of five-ninths of three-eighths of 168'; assert(isequal(round(fraction_of_a(frac_str)),10)) case 3 frac_str = 'one-half of two-thirds of three-fourths of four-fifths of five-sixths of six-sevenths of seven-eighths of eight-ninths of 36288'; assert(isequal(round(fraction_of_a(frac_str)),4032)) case 4 frac_str = 'one-seventh of two-ninths of 630'; assert(isequal(round(fraction_of_a(frac_str)),20)) end

Assertion failed.

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!