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 174335

Submitted on 7 Dec 2012 by J.R.! Menzinger

Correct

46Size
Leading solution size is 19.
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
 
%%
amt = 34.2;
str = '$34.20';
assert(isequal(disp_currency(amt),str))

                    
2
Pass
 
%%
amt = 91337585;
str = '$91,337,585.00';
assert(isequal(disp_currency(amt),str))

                    
3
Pass
 
%%
amt = -63234922.46;
str = '($63,234,922.46)';
assert(isequal(disp_currency(amt),str))

                    
4
Pass
 
%%
amt = 2784.9;
str = '$2,784.90';
assert(isequal(disp_currency(amt),str))