Cody

Solution 425041

Submitted on 2 Apr 2014 by Tim
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
%% item_price = [10 35 2 100 99 87 1 0.5 9 30] ; total_items_shopped = [ 2 0 5 10 8 9 1 0 0 1]; shop_no = 5; avg_spending =73.22; shop_prob = 0.22 [x,y] = Shopping(item_price ,total_items_shopped, shop_no ); assert(isequal([x,y],[avg_spending, shop_prob]))
shop_prob = 11/50
2   Pass
%% item_price = [10 4 22 10 5 7 2 10 95 56] ; total_items_shopped = [ 23 0 0 11 38 0 1 0 0 0]; shop_no = 7; avg_spending =7.29; shop_prob = 0.01 [x,y] = Shopping(item_price ,total_items_shopped, shop_no ); assert(isequal([x,y],[avg_spending, shop_prob]))
shop_prob = 1/100
3   Pass
%% item_price = ones(1, 10) ; %dollar shoppie total_items_shopped = [ 1 0 3 4 8 9 0 5 0 10]; shop_no = 10; avg_spending = 1; shop_prob = 0.25; [x,y] = Shopping(item_price ,total_items_shopped, shop_no ); assert(isequal([x,y],[avg_spending, shop_prob]))