Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 291223

Submitted on 28 Jul 2013 by @bmtran

Correct

20Size
Leading solution size is 11.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
diameter = 12;
cost = 12;
value_correct = 0.1061;
assert ( abs(PizzaValue(diameter, cost) - value_correct) < 0.0001)

                    
2
Pass
 
%%
diameter = 16;
cost = 18;
value_correct = 0.0895;
assert ( abs(PizzaValue(diameter, cost) - value_correct) < 0.0001)

                    
3
Pass
 
%%
diameter = 20;
cost = 24;
value_correct = 0.0764;
assert ( abs(PizzaValue(diameter, cost) - value_correct) < 0.0001)