Cody

Problem 42386. Faint Receipt

Solution 2291211

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

amt = 367.9200 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 3.0000 3.0000 3.0000

Assertion failed.

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

amt = 1.0e+03 * 1.0317 0.0050 0.0050 0.0050 0.0040 0.0040 0.0040 0.0040 0.0040 0.0040

Assertion failed.

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

amt = 1.0e+03 * 1.0416 0.0030 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060 0.0060

Assertion failed.

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

amt = 1.0e+03 * 6.4229 0 0 0.0060 0.0060 0.0060 0.0010 0.0010 0.0010 0.0070

Assertion failed.

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

amt = 250.1000 0 4.0000 8.0000 8.0000 3.0000 3.0000 7.0000 7.0000 2.0000

Assertion failed.

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

amt = 1.0e+04 * 1.0030 0 0 0 0 0 0 0 0 0

Assertion failed.

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

amt = 1.0e+03 * 1.0037 0 0 0 0 0 0 0 0 0

Assertion failed.

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

amt = 10.8200 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 8.0000 8.0000 8.0000

Assertion failed.

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

amt = 46.1700 7.0000 7.0000 7.0000 7.0000 7.0000 7.0000 7.0000 6.0000 6.0000

Assertion failed.

10   Fail
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)))

amt = 367.9200 2.0000 2.0000 2.0000 2.0000 2.0000 2.0000 3.0000 3.0000 3.0000

Assertion failed.

11   Fail
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)))

amt = 250.1000 0 4.0000 8.0000 8.0000 3.0000 3.0000 7.0000 7.0000 2.0000

Assertion failed.

12   Fail
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)))

amt = 1.0e+03 * 1.0037 0 0 0 0 0 0 0 0 0

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!