Cody

Solution 688129

Submitted on 17 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   Pass
%% partial_amt = 'X67.9X'; qty = 72; amt_corr = 367.92; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 367.9200

2   Fail
%% partial_amt = 'X31.6X'; qty = 111; amt_corr = 531.69; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

Output argument "ans" (and maybe others) not assigned during call to "faint_receipt".

3   Pass
%% partial_amt = 'X41.6X'; qty = 67; amt_corr = 741.69; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 741.6900

4   Pass
%% partial_amt = 'X422.9X'; qty = 31; amt_corr = 1422.90; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 1.4229e+03

5   Fail
%% partial_amt = 'X50.1X'; qty = 17; amt_corr = 150.11; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 450.1600

Assertion failed.

6   Pass
%% partial_amt = 'X029.9X'; qty = 417; amt_corr = 1029.99; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 1.0300e+03

7   Pass
%% partial_amt = 'X03.7X'; qty = 107; amt_corr = 103.79; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 103.7900

8   Pass
%% partial_amt = 'X0.8X'; qty = 77; amt_corr = 30.80; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 30.8000

9   Pass
%% partial_amt = 'X6.1X'; qty = 99; amt_corr = 86.13; assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 86.1300

10   Pass
%% anti-cheating case ind = randi(4); switch ind case 1 partial_amt = 'X50.1X'; qty = 17; amt_corr = 150.11; case 2 partial_amt = 'X0.8X'; qty = 77; amt_corr = 30.80; case 3 partial_amt = 'X67.9X'; qty = 72; amt_corr = 367.92; case 4 partial_amt = 'X422.9X'; qty = 31; amt_corr = 1422.90; end assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 367.9200

11   Fail
%% anti-cheating case ind = randi(4); switch ind case 1 partial_amt = 'X31.6X'; qty = 111; amt_corr = 531.69; case 2 partial_amt = 'X50.1X'; qty = 17; amt_corr = 150.11; case 3 partial_amt = 'X41.6X'; qty = 67; amt_corr = 741.69; case 4 partial_amt = 'X029.9X'; qty = 417; amt_corr = 1029.99; end assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

Output argument "ans" (and maybe others) not assigned during call to "faint_receipt".

12   Pass
%% anti-cheating case ind = randi(4); switch ind case 1 partial_amt = 'X422.9X'; qty = 31; amt_corr = 1422.90; case 2 partial_amt = 'X67.9X'; qty = 72; amt_corr = 367.92; case 3 partial_amt = 'X03.7X'; qty = 107; amt_corr = 103.79; case 4 partial_amt = 'X31.6X'; qty = 111; amt_corr = 531.69; end assert(isequal(amt_corr,faint_receipt(partial_amt,qty)))

ans = 103.7900