Cody

Problem 2019. Dimensions of a rectangle

Solution 3467943

Submitted on 29 Oct 2020 at 11:35
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 = 1 length_correct = 3/sqrt(10); width_correct = 1/sqrt(10); [width, length] = findRectangleDimensions(x); tolerance = 1e-12; assert( abs(length-length_correct)<tolerance && abs(width-width_correct)<tolerance )

x = 1

Undefined function 'sqt' for input arguments of type 'double'. Error in findRectangleDimensions (line 2) width = x/sqt(10); Error in Test1 (line 4) [width, length] = findRectangleDimensions(x);

2   Fail
x = 2; width_correct = 2/sqrt(10); length_correct = 6/sqrt(10); [width, length] = findRectangleDimensions(x); tolerance = 1e-12; assert(abs(length-length_correct)<tolerance && abs(width-width_correct)<tolerance)

Undefined function 'sqt' for input arguments of type 'double'. Error in findRectangleDimensions (line 2) width = x/sqt(10); Error in Test2 (line 4) [width, length] = findRectangleDimensions(x);

Suggested Problems

More from this Author10

Community Treasure Hunt

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

Start Hunting!